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