8f37c1b4ead8e84d2250cca7ecd1c865fd6cd36d
[citadel.git] / citadel / serv_imap.h
1 /* $Id$ 
2  */
3
4 extern long SYM_IMAP;
5
6
7 void imap_cleanup_function(void);
8 void imap_greeting(void);
9 void imap_command_loop(void);
10 int imap_grabroom(char *returned_roomname, char *foldername);
11 void imap_free_transmitted_message(void);
12
13
14
15 struct citimap {
16         int authstate;
17         char authseq[SIZ];
18         int selected;           /* set to 1 if in the SELECTED state */
19         int readonly;           /* mailbox is open read only */
20         int num_msgs;           /* Number of messages being mapped */
21         long *msgids;
22         unsigned int *flags;
23         char *transmitted_message;      /* for APPEND command... */
24         size_t transmitted_length;
25 };
26
27 /*
28  * values of 'authstate'
29  */
30 enum {
31         imap_as_normal,
32         imap_as_expecting_username,
33         imap_as_expecting_password
34 };
35
36 /* Flags for the above struct.  Note that some of these are for internal use,
37  * and are not to be reported to IMAP clients.
38  */
39 #define IMAP_ANSWERED           1
40 #define IMAP_FLAGGED            2
41 #define IMAP_DELETED            4
42 #define IMAP_DRAFT              8
43 #define IMAP_SEEN               16
44
45 #define IMAP_MASK_SETABLE       0x1f
46 #define IMAP_MASK_SYSTEM        0xe0
47
48 #define IMAP_SELECTED           32      /* internal */
49
50
51 #define IMAP ((struct citimap *)CtdlGetUserData(SYM_IMAP))
52
53 /*
54  * When loading arrays of message ID's into memory, increase the buffer to
55  * hold this many additional messages instead of calling realloc() each time.
56  */
57 #define REALLOC_INCREMENT 100