citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

serv_imap.h
Go to the documentation of this file.
1#define GLOBAL_UIDVALIDITY_VALUE 1L
2
3
4void imap_cleanup_function(void);
5void imap_greeting(void);
6void imap_command_loop(void);
7int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok);
9int imap_do_expunge(void);
10void imap_rescan_msgids(void);
11
12/*
13 * FDELIM defines which character we want to use as a folder delimiter
14 * in room names. Originally we used a forward slash, but that caused
15 * rooms with names like "Sent/Received Pages" to get delimited, so we
16 * changed it to a backslash. This is completely irrelevant to how Citadel
17 * speaks to IMAP clients -- the delimiter used in the IMAP protocol is
18 * a vertical bar, which is illegal in Citadel room names anyway.
19 */
20
21typedef void (*imap_handler)(int num_parms, ConstStr *Params);
22
23typedef struct _imap_handler_hook {
25 int Flags;
27
28typedef struct __citimap_command {
29 StrBuf *CmdBuf; /* our current commandline; gets chopped into: */
30 ConstStr *Params; /* Commandline tokens */
31 int num_parms; /* Number of Commandline tokens available */
32 int avail_parms; /* Number of ConstStr args is big */
35
36
37typedef struct __citimap {
38 StrBuf *Reply;
40 char authseq[SIZ];
41 int selected; /* set to 1 if in the SELECTED state */
42 int readonly; /* mailbox is open read only */
43 int num_msgs; /* Number of messages being mapped */
44 int num_alloc; /* Number of messages for which we've allocated space */
45 time_t last_mtime; /* For checking whether the room was modified... */
46 long *msgids;
47 unsigned int *flags;
48
49 StrBuf *TransmittedMessage; /* for APPEND command... */
50
51 citimap_command Cmd; /* our current commandline */
52
53 /* Cache most recent RFC822 FETCH because client might load in pieces */
56 char cached_rfc822_withbody; /* 1 = body cached; 0 = only headers cached */
57
58 /* Cache most recent BODY FETCH because client might load in pieces */
63 char cached_body_withbody; /* 1 = body cached; 0 = only headers cached */
65
66/*
67 * values of 'authstate'
68 */
69enum {
76};
77
78/* Flags for the above struct. Note that some of these are for internal use,
79 * and are not to be reported to IMAP clients.
80 */
81#define IMAP_ANSWERED 1 /* reportable and setable */
82#define IMAP_FLAGGED 2 /* reportable and setable */
83#define IMAP_DELETED 4 /* reportable and setable */
84#define IMAP_DRAFT 8 /* reportable and setable */
85#define IMAP_SEEN 16 /* reportable and setable */
86
87#define IMAP_MASK_SETABLE 0x1f
88#define IMAP_MASK_SYSTEM 0xe0
89
90#define IMAP_SELECTED 32 /* neither reportable nor setable */
91#define IMAP_RECENT 64 /* reportable but not setable */
92
93
94/*
95 * Flags that may be returned by imap_roomname()
96 * (the lower eight bits will be the floor number)
97 */
98#define IR_MAILBOX 0x0100 /* Mailbox */
99#define IR_EXISTS 0x0200 /* Room exists (not implemented) */
100#define IR_BABOON 0x0000 /* Just had to put this here :) */
101
102#define FDELIM '\\'
103
104#define IMAP ((citimap *)CC->session_specific_data)
105#define CCCIMAP ((citimap *)CCC->session_specific_data)
106
107#define IMAPDBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (IMAPDebugEnabled != 0))
108
109#define I_FLAG_NONE (0)
110#define I_FLAG_LOGGED_IN (1<<0)
111#define I_FLAG_SELECT (1<<1)
112/* RFC3501 says that we cannot output untagged data during these commands */
113#define I_FLAG_UNTAGGED (1<<2)
114
115/*
116 * When loading arrays of message ID's into memory, increase the buffer to
117 * hold this many additional messages instead of calling realloc() each time.
118 */
119#define REALLOC_INCREMENT 100
120
121
122void registerImapCMD(const char *First, long FLen,
123 const char *Second, long SLen,
124 imap_handler H,
125 int Flags);
126
127#define RegisterImapCMD(First, Second, H, Flags) \
128 registerImapCMD(HKEY(First), HKEY(Second), H, Flags)
void(* imap_handler)(int num_parms, ConstStr *Params)
Definition: serv_imap.h:21
@ imap_as_expecting_multilinepassword
Definition: serv_imap.h:75
@ imap_as_expecting_plainauth
Definition: serv_imap.h:73
@ imap_as_expecting_password
Definition: serv_imap.h:72
@ imap_as_expecting_username
Definition: serv_imap.h:71
@ imap_as_expecting_multilineusername
Definition: serv_imap.h:74
@ imap_as_normal
Definition: serv_imap.h:70
void registerImapCMD(const char *First, long FLen, const char *Second, long SLen, imap_handler H, int Flags)
Definition: serv_imap.c:58
struct __citimap_command citimap_command
void imap_rescan_msgids(void)
Definition: serv_imap.c:321
void imap_cleanup_function(void)
Definition: serv_imap.c:453
int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok)
Definition: serv_imap.c:1109
void imap_command_loop(void)
Definition: serv_imap.c:1489
int imap_do_expunge(void)
Definition: serv_imap.c:922
void imap_free_transmitted_message(void)
Definition: serv_imap.c:166
struct __citimap citimap
struct _imap_handler_hook imap_handler_hook
void imap_greeting(void)
Definition: serv_imap.c:556
ConstStr * Params
Definition: serv_imap.h:30
const imap_handler_hook * hh
Definition: serv_imap.h:33
StrBuf * CmdBuf
Definition: serv_imap.h:29
citimap_command Cmd
Definition: serv_imap.h:51
int num_alloc
Definition: serv_imap.h:44
StrBuf * TransmittedMessage
Definition: serv_imap.h:49
char cached_bodypart[SIZ]
Definition: serv_imap.h:61
int selected
Definition: serv_imap.h:41
StrBuf * Reply
Definition: serv_imap.h:38
StrBuf * cached_rfc822
Definition: serv_imap.h:54
unsigned int * flags
Definition: serv_imap.h:47
int authstate
Definition: serv_imap.h:39
int num_msgs
Definition: serv_imap.h:43
long cached_bodymsgnum
Definition: serv_imap.h:62
int readonly
Definition: serv_imap.h:42
char * cached_body
Definition: serv_imap.h:59
char cached_body_withbody
Definition: serv_imap.h:63
char authseq[SIZ]
Definition: serv_imap.h:40
size_t cached_body_len
Definition: serv_imap.h:60
long * msgids
Definition: serv_imap.h:46
long cached_rfc822_msgnum
Definition: serv_imap.h:55
char cached_rfc822_withbody
Definition: serv_imap.h:56
time_t last_mtime
Definition: serv_imap.h:45
imap_handler h
Definition: serv_imap.h:24
#define SIZ
Definition: sysconfig.h:33