2 * $Id: imap.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2018 Eduardo Chappa
6 * Copyright 2006 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_IMAP_INCLUDED
18 #define PITH_IMAP_INCLUDED
21 #include "../pith/string.h"
24 #define NETMAXPASSWD 100
28 * struct used to keep track of password/host/user triples.
29 * The problem is we only want to try user names and passwords if
30 * we've already tried talking to this host before.
33 typedef struct _mmlogin_s
{
37 unsigned ok_novalidate
:1;
40 struct _mmlogin_s
*next
;
44 typedef struct _se_app_s
{
51 * struct to help manage mail_list calls/callbacks
53 typedef struct mm_list_s
{
56 void (*filter
)(MAILSTREAM
*, char *, int, long, void *, unsigned);
62 * return values for IMAP URL parser
64 #define URL_IMAP_MASK 0x0007
65 #define URL_IMAP_ERROR 0
66 #define URL_IMAP_IMAILBOXLIST 0x0001
67 #define URL_IMAP_IMESSAGELIST 0x0002
68 #define URL_IMAP_IMESSAGEPART 0x0004
69 #define URL_IMAP_IMBXLSTLSUB 0x0010
70 #define URL_IMAP_ISERVERONLY 0x0020
74 * Exported globals setup by searching functions to tell mm_searched
75 * where to put message numbers that matched the search criteria,
76 * and to allow mm_searched to return number of matches.
78 extern MAILSTREAM
*mm_search_stream
;
79 extern long mm_search_count
;
80 extern MAILSTATUS mm_status_result
;
82 extern MM_LIST_S
*mm_list_info
;
85 extern MMLOGIN_S
*mm_login_list
;
86 extern MMLOGIN_S
*cert_failure_list
;
90 * These are declared in c-client and implemented in ../pith/imap.c
93 void mm_searched (MAILSTREAM
*stream
,unsigned long number
);
94 void mm_exists (MAILSTREAM
*stream
,unsigned long number
);
95 void mm_expunged (MAILSTREAM
*stream
,unsigned long number
);
96 void mm_flags (MAILSTREAM
*stream
,unsigned long number
);
97 void mm_list (MAILSTREAM
*stream
,int delimiter
,char *name
,long attributes
);
98 void mm_lsub (MAILSTREAM
*stream
,int delimiter
,char *name
,long attributes
);
99 void mm_status (MAILSTREAM
*stream
,char *mailbox
,MAILSTATUS
*status
);
100 void mm_dlog (char *string
);
101 void mm_critical (MAILSTREAM
*stream
);
102 void mm_nocritical (MAILSTREAM
*stream
);
103 void mm_fatal (char *string
);
107 * These are declared in c-client and must be implemented in application
110 void mm_notify (MAILSTREAM
*stream
,char *string
,long errflg
);
111 void mm_log (char *string
,long errflg
);
112 void mm_login (NETMBX
*mb
,char *user
,char *pwd
,long trial
);
113 long mm_diskerror (MAILSTREAM
*stream
,long errcode
,long serious
);
117 /* exported protoypes */
118 char *imap_referral(MAILSTREAM
*, char *, long);
119 long imap_proxycopy(MAILSTREAM
*, char *, char *, long);
120 char *cached_user_name(char *);
121 int imap_same_host(STRLIST_S
*, STRLIST_S
*);
122 int imap_get_ssl(MMLOGIN_S
*, STRLIST_S
*, int *, int *);
123 char *imap_get_user(MMLOGIN_S
*, STRLIST_S
*);
124 int imap_get_passwd(MMLOGIN_S
*, char *, char *, STRLIST_S
*, int);
125 void imap_set_passwd(MMLOGIN_S
**, char *, char *, STRLIST_S
*, int, int, int);
126 void imap_flush_passwd_cache(int);
129 /* currently mandatory to implement stubs */
131 /* called by build_folder_list(), ok if it does nothing */
132 void set_read_predicted(int);
133 void mm_login_work (NETMBX
*mb
,char *user
,char *pwd
,long trial
,char *usethisprompt
, char *altuserforcache
);
135 /* this is necessary to figure out the name of the password file of the application. */
137 char *passfile_name(char *, char *, size_t);
138 #endif /* PASSFILE */
140 #endif /* PITH_IMAP_INCLUDED */