2117a6ef4006d2763308122b95025d06c79d6cb0
[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 int imap_parameterize(citimap_command *Cmd);
28 long imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf);
29 int imap_roomname(char *buf, int bufsize, const char *foldername);
30 int imap_is_message_set(const char *);
31 int imap_mailbox_matches_pattern(const char *pattern, char *mailboxname);
32 int imap_datecmp(const char *datestr, time_t msgtime);
33
34
35 /* Imap Append Printf, send to the outbuffer */
36 void IAPrintf(const char *Format, ...) __attribute__((__format__(__printf__,1,2)));
37
38 void iaputs(const char *Str, long Len);
39 #define IAPuts(Msg) iaputs(HKEY(Msg))
40 /* give it a naughty name since its ugly. */
41 #define _iaputs(Msg) iaputs(Msg, strlen(Msg))
42
43 /* outputs a static message prepended by the sequence no */
44 void ireply(const char *Msg, long len);
45 #define IReply(msg) ireply(HKEY(msg))
46 /* outputs a dynamic message prepended by the sequence no */
47 void IReplyPrintf(const char *Format, ...);
48
49
50 /* output a string like that {%ld}%s */
51 void IPutStr(const char *Msg, long Len);
52 #define IPutCStr(_ConstStr) IPutStr(CKEY(_ConstStr))
53 #define IPutCParamStr(n) IPutStr(CKEY(Params[n]))
54 #define IPutMsgField(Which) IPutStr(CM_KEY(msg, Which))
55 void IUnbuffer (void);