78e2f5afdd58a573bb2ad5e46ec362aa99c342e3
[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 void MakeStringOf(StrBuf *Buf, int skip);
39
40 int CmdAdjust(citimap_command *Cmd, 
41               int nArgs,
42               int Realloc);
43
44
45 void imap_strout(ConstStr *args);
46 void plain_imap_strout(char *buf);
47 int imap_parameterize(citimap_command *Cmd);
48 int old_imap_parameterize(char** args, char *n);
49 void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf);
50 void imap_ial_out(struct internet_address_list *ialist);
51 int imap_roomname(char *buf, int bufsize, const char *foldername);
52 int imap_is_message_set(const char *);
53 int imap_mailbox_matches_pattern(const char *pattern, char *mailboxname);
54 int imap_datecmp(const char *datestr, time_t msgtime);
55
56 /*
57  * Flags that may be returned by imap_roomname()
58  * (the lower eight bits will be the floor number)
59  */
60 #define IR_MAILBOX      0x0100          /* Mailbox                       */
61 #define IR_EXISTS       0x0200          /* Room exists (not implemented) */
62 #define IR_BABOON       0x0000          /* Just had to put this here :)  */