099d9c39b062bdffeca7761a2767001ea1a2a5f0
[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 /* Imap Append Printf, send to the outbuffer */
38 void IAPrintf(const char *Format, ...) __attribute__((__format__(__printf__,1,2)));
39
40 void iaputs(const char *Str, long Len);
41 #define IAPuts(Msg) iaputs(HKEY(Msg))
42 /* give it a naughty name since its ugly. */
43 #define _iaputs(Msg) iaputs(Msg, strlen(Msg))
44
45 /* outputs a static message prepended by the sequence no */
46 void ireply(const char *Msg, long len);
47 #define IReply(msg) ireply(HKEY(msg))
48 /* outputs a dynamic message prepended by the sequence no */
49 void IReplyPrintf(const char *Format, ...);
50
51
52 /* output a string like that {%ld}%s */
53 void IPutStr(const char *Msg, long Len);
54 #define IPutCStr(_ConstStr) IPutStr(CKEY(_ConstStr))
55 #define IPutCParamStr(n) IPutStr(CKEY(Params[n]))
56
57 void IUnbuffer (void);