2 * mailbox and message representations
4 * these structures are allocated with emalloc and must be explicitly freed
6 typedef struct Box Box;
7 typedef struct Header Header;
8 typedef struct MAddr MAddr;
9 typedef struct MbLock MbLock;
10 typedef struct MimeHdr MimeHdr;
11 typedef struct Msg Msg;
12 typedef struct NamedInt NamedInt;
13 typedef struct Pair Pair;
17 StrAlloc = 32, /* characters allocated at a time */
18 BufSize = 8*1024, /* size of transfer block */
19 NDigest = 40, /* length of digest string */
20 NUid = 10, /* length of .imp uid string */
21 NFlags = 8, /* length of .imp flag string */
22 LockSecs = 5 * 60, /* seconds to wait for acquiring a locked file */
23 MboxNameLen = 256, /* max. length of upas/fs mbox name */
24 MsgNameLen = 32, /* max. length of a file in a upas/fs mbox */
25 UserNameLen = 64, /* max. length of user's name */
27 MUtf7Max = 6, /* max length for a modified utf7 character: &bbbb- */
42 NotBogus = 0, /* the message is displayable */
43 BogusHeader = 1, /* the header had bad characters */
44 BogusBody = 2, /* the body had bad characters */
45 BogusTried = 4, /* attempted to open the fake message */
50 char *name; /* path name of mailbox */
51 char *fs; /* fs name of mailbox */
52 char *fsDir; /* /mail/fs/box->fs */
53 char *imp; /* path name of .imp file */
54 uchar writable; /* can write back messages? */
55 uchar dirtyImp; /* .imp file needs to be written? */
56 uchar sendFlags; /* need flags update */
57 Qid qid; /* qid of fs mailbox */
58 Qid impQid; /* qid of .imp when last synched */
59 long mtime; /* file mtime when last read */
60 ulong max; /* maximum msgs->seq, same as number of messages */
61 ulong toldMax; /* last value sent to client */
62 ulong recent; /* number of recently received messaged */
63 ulong toldRecent; /* last value sent to client */
64 ulong uidnext; /* next uid value assigned to a message */
65 ulong uidvalidity; /* uid of mailbox */
88 IInReplyTo, /* aka internal date */
92 ILines, /* number of lines of raw body */
99 char *buf; /* header, including terminating \r\n */
100 ulong size; /* strlen(buf) */
101 ulong lines; /* number of \n characters in buf */
104 * pre-parsed mime headers
106 MimeHdr *type; /* content-type */
107 MimeHdr *id; /* content-id */
108 MimeHdr *description; /* content-description */
109 MimeHdr *encoding; /* content-transfer-encoding */
110 MimeHdr *md5; /* content-md5 */
111 MimeHdr *disposition; /* content-disposition */
112 MimeHdr *language; /* content-language */
121 char *fsDir; /* box->fsDir of enclosing message */
122 Header head; /* message header */
123 Header mime; /* mime header from enclosing multipart spec */
125 uchar sendFlags; /* flags value needs to be sent to client */
126 uchar expunged; /* message actually expunged, but not yet reported to client */
127 uchar matched; /* search succeeded? */
128 uchar bogus; /* implies the message is invalid, ie contains nulls; see flags above */
129 ulong uid; /* imap unique identifier */
130 ulong seq; /* position in box; 1 is oldest */
131 ulong id; /* number of message directory in upas/fs */
132 char *fs; /* name of message directory */
133 char *efs; /* pointer after / in fs; enough space for file name */
135 ulong size; /* size of fs/rawbody, in bytes, with \r added before \n */
136 ulong lines; /* number of lines in rawbody */
139 char *info[IMax]; /* all info about message */
144 MAddr *to; /* parsed out address lines */
153 * pre-parsed header lines
171 * mapping of integer & names
180 * lock for all mail file operations
188 * parse nodes for imap4rev1 protocol
190 * important: all of these items are allocated
191 * in one can, so they can be tossed out at the same time.
192 * this allows leakless parse error recovery by simply tossing the can away.
193 * however, it means these structures cannot be mixed with the mailbox structures
196 typedef struct Fetch Fetch;
197 typedef struct NList NList;
198 typedef struct SList SList;
199 typedef struct MsgSet MsgSet;
200 typedef struct Store Store;
201 typedef struct Search Search;
204 * parse tree for fetch command
218 FBodySect, /* BODY [...] */
238 uchar op; /* F.* operator */
239 uchar part; /* FP.* subpart for body[] & body.peek[]*/
240 uchar partial; /* partial fetch? */
241 long start; /* partial fetch amounts */
255 SUidValidity = 1 << 3,
260 * parse tree for store command
278 * parse tree for search command
368 extern Bin *parseBin;
371 extern char username[UserNameLen];
372 extern char mboxDir[MboxNameLen];
373 extern char *fetchPartNames[FPMax];