* rework imap tokenizer, we no longer copy the stuff around, we keep a reference...
[citadel.git] / citadel / imap_tools.h
1 /*
2  * $Id$
3  *
4  */
5
6 /*
7  * FDELIM defines which character we want to use as a folder delimiter
8  * in room names.  Originally we used a forward slash, but that caused
9  * rooms with names like "Sent/Received Pages" to get delimited, so we
10  * changed it to a backslash.  This is completely irrelevant to how Citadel
11  * speaks to IMAP clients -- the delimiter used in the IMAP protocol is
12  * a vertical bar, which is illegal in Citadel room names anyway.
13  */
14 #define FDELIM '\\'
15
16 typedef struct __citimap_command {
17         StrBuf *CmdBuf;                 /* our current commandline; gets chopped into: */
18         ConstStr *Params;               /* Commandline tokens */
19         int num_parms;                  /* Number of Commandline tokens available */
20         int avail_parms;                /* Number of ConstStr args is big */
21 } citimap_command;
22
23 /* 
24  * since we work with shifted pointers to ConstStrs in some places, 
25  * we can't just say we want to cut the n'th of Cmd, we have to pass it in
26  * and rely on that CutMe references Cmd->CmdBuf; else peek won't work out
27  * and len will differ.
28  */
29 void TokenCutRight(citimap_command *Cmd, 
30                    ConstStr *CutMe,
31                    int n);
32 /*
33  * since we just move Key around here, Cmd is just here so the syntax is identical.
34  */
35 void TokenCutLeft(citimap_command *Cmd, 
36                   ConstStr *CutMe,
37                   int n);
38
39
40 void imap_strout(ConstStr *args);
41 void plain_imap_strout(char *buf);
42 int imap_parameterize(citimap_command *Cmd);
43 int old_imap_parameterize(char** args, char *n);
44 void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf);
45 void imap_ial_out(struct internet_address_list *ialist);
46 int imap_roomname(char *buf, int bufsize, const char *foldername);
47 int imap_is_message_set(const char *);
48 int imap_mailbox_matches_pattern(char *pattern, char *mailboxname);
49 int imap_datecmp(const char *datestr, time_t msgtime);
50
51 /*
52  * Flags that may be returned by imap_roomname()
53  * (the lower eight bits will be the floor number)
54  */
55 #define IR_MAILBOX      0x0100          /* Mailbox                       */
56 #define IR_EXISTS       0x0200          /* Room exists (not implemented) */
57 #define IR_BABOON       0x0000          /* Just had to put this here :)  */