Rewrite IMAP-Module to buffer its output
[citadel.git] / citadel / modules / imap / imap_tools.h
1
2 /* 
3  * since we work with shifted pointers to ConstStrs in some places, 
4  * we can't just say we want to cut the n'th of Cmd, we have to pass it in
5  * and rely on that CutMe references Cmd->CmdBuf; else peek won't work out
6  * and len will differ.
7  */
8 void TokenCutRight(citimap_command *Cmd, 
9                    ConstStr *CutMe,
10                    int n);
11 /*
12  * since we just move Key around here, Cmd is just here so the syntax is identical.
13  */
14 void TokenCutLeft(citimap_command *Cmd, 
15                   ConstStr *CutMe,
16                   int n);
17 void MakeStringOf(StrBuf *Buf, int skip);
18
19 int CmdAdjust(citimap_command *Cmd, 
20               int nArgs,
21               int Realloc);
22
23
24 void imap_strout(ConstStr *args);
25 void imap_strbuffer(StrBuf *Reply, ConstStr *args);
26 void plain_imap_strbuffer(StrBuf *Reply, char *buf);
27 void plain_imap_strout(char *buf);
28 int imap_parameterize(citimap_command *Cmd);
29 void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf);
30 void imap_ial_out(struct internet_address_list *ialist);
31 int imap_roomname(char *buf, int bufsize, const char *foldername);
32 int imap_is_message_set(const char *);
33 int imap_mailbox_matches_pattern(const char *pattern, char *mailboxname);
34 int imap_datecmp(const char *datestr, time_t msgtime);
35
36
37
38
39
40 /* Imap Append Printf, send to the outbuffer */
41 void IAPrintf(const char *Format, ...);
42
43 void iaputs(const char *Str, long Len);
44 #define IAPuts(Msg) iaputs(HKEY(Msg))
45 /* give it a naughty name since its ugly. */
46 #define _iaputs(Msg) iaputs(Msg, strlen(Msg))
47
48 /* outputs a static message prepended by the sequence no */
49 void ireply(const char *Msg, long len);
50 #define IReply(msg) ireply(HKEY(msg))
51 /* outputs a dynamic message prepended by the sequence no */
52 void IReplyPrintf(const char *Format, ...);
53
54
55 /* output a string like that {%ld}%s */
56 void IPutStr(const char *Msg, long Len);
57 #define IPutCStr(_ConstStr) IPutStr(CKEY(_ConstStr))
58 #define IPutCParamStr(n) IPutStr(CKEY(Params[n]))
59
60 /*
61 void plain_imap_strout(char *buf)
62 void imap_strout(ConstStr *args)
63 */
64
65