]> code.citadel.org Git - citadel.git/blob - citadel/serv_imap.h
* Trying to fix IMAP brokenness on Linux-x64. Committing changes even
[citadel.git] / citadel / serv_imap.h
1 /* $Id$ 
2  */
3
4
5 void imap_cleanup_function(void);
6 void imap_greeting(void);
7 void imap_command_loop(void);
8 int imap_grabroom(char *returned_roomname, char *foldername);
9 void imap_free_transmitted_message(void);
10 int imap_do_expunge(void);
11
12
13 struct citimap {
14         int authstate;
15         char authseq[SIZ];
16         int selected;                   /* set to 1 if in the SELECTED state */
17         int readonly;                   /* mailbox is open read only */
18         int num_msgs;                   /* Number of messages being mapped */
19         long *msgids;
20         unsigned int *flags;
21         char *transmitted_message;      /* for APPEND command... */
22         size_t transmitted_length;
23
24         FILE *cached_fetch;             /* cache our most recent RFC822 FETCH */
25         long cached_msgnum;             /* because the client might ask for it in pieces */
26
27         FILE *cached_body;              /* cache our most recent BODY FETCH */
28         char cached_bodypart[SIZ];      /* because the client might ask for it in pieces */
29         long cached_bodymsgnum;
30 };
31
32 /*
33  * values of 'authstate'
34  */
35 enum {
36         imap_as_normal,
37         imap_as_expecting_username,
38         imap_as_expecting_password
39 };
40
41 /* Flags for the above struct.  Note that some of these are for internal use,
42  * and are not to be reported to IMAP clients.
43  */
44 #define IMAP_ANSWERED           1       /* reportable and setable */
45 #define IMAP_FLAGGED            2       /* reportable and setable */
46 #define IMAP_DELETED            4       /* reportable and setable */
47 #define IMAP_DRAFT              8       /* reportable and setable */
48 #define IMAP_SEEN               16      /* reportable and setable */
49
50 #define IMAP_MASK_SETABLE       0x1f
51 #define IMAP_MASK_SYSTEM        0xe0
52
53 #define IMAP_SELECTED           32      /* neither reportable nor setable */
54 #define IMAP_RECENT             64      /* reportable but not setable */
55
56
57 #define IMAP ((struct citimap *)CtdlGetUserData(SYM_IMAP))
58
59 /*
60  * When loading arrays of message ID's into memory, increase the buffer to
61  * hold this many additional messages instead of calling realloc() each time.
62  */
63 #define REALLOC_INCREMENT 100