1 typedef struct Message Message;
9 // pointers into message
10 char *start; // start of message
11 char *end; // end of message
12 char *header; // start of header
13 char *hend; // end of header
14 int hlen; // length of header minus ignored fields
15 char *mheader; // start of mime header
16 char *mhend; // end of mime header
17 char *body; // start of body
18 char *bend; // end of body
19 char *rbody; // raw (unprocessed) body
20 char *rbend; // end of raw (unprocessed) body
24 char mallocd; // message is malloc'd
25 char ballocd; // body is malloc'd
26 char hallocd; // header is malloce'd
55 char lines[10]; // number of lines in rawbody
57 Message *next; // same level
58 Message *part; // down a level
59 Message *whole; // up a level
61 uchar digest[SHA1dlen];
63 vlong imapuid; // used by imap4
65 char uidl[80]; // used by pop3
76 // disposition possibilities
85 typedef struct Mailbox Mailbox;
88 QLock ql; /* jpc named Qlock */
92 int dolock; // lock when syncing?
98 int vers; // goes up each time mailbox is read
101 char *(*sync)(Mailbox*, int);
102 void (*close)(Mailbox*);
103 char *(*fetch)(Mailbox*, Message*);
104 char *(*ctl)(Mailbox*, int, char**);
105 void *aux; // private to Mailbox implementation
108 typedef char *Mailboxinit(Mailbox*, char*);
110 extern Message *root;
111 extern Mailboxinit plan9mbox;
112 extern Mailboxinit pop3mbox;
113 extern Mailboxinit imap4mbox;
115 char* syncmbox(Mailbox*, int);
116 char* geterrstr(void);
117 void* emalloc(ulong);
118 void* erealloc(void*, ulong);
119 Message* newmessage(Message*);
120 void delmessage(Mailbox*, Message*);
121 void delmessages(int, char**);
123 void mailplumb(Mailbox*, Message*, int);
124 char* newmbox(char*, char*, int);
125 void freembox(char*);
126 void logmsg(char*, Message*);
127 void msgincref(Message*);
128 void msgdecref(Mailbox*, Message*);
129 void mboxincref(Mailbox*);
130 void mboxdecref(Mailbox*);
131 void convert(Message*);
132 void decode(Message*);
133 int cistrncmp(char*, char*, int);
134 int cistrcmp(char*, char*);
135 int latin1toutf(char*, char*, char*);
136 int windows1257toutf(char*, char*, char*);
137 int decquoted(char*, char*, char*);
138 int xtoutf(char*, char**, char*, char*);
139 void countlines(Message*);
140 int headerlen(Message*);
141 void parse(Message*, int, Mailbox*, int);
142 void parseheaders(Message*, int, Mailbox*, int);
143 void parsebody(Message*, Mailbox*);
144 void parseunix(Message*);
145 String* date822tounix(char*);
146 int fidmboxrefs(Mailbox*);
147 int hashmboxrefs(Mailbox*);
148 void checkmboxrefs(void);
153 extern char user[Elemlen];
154 extern char stdmbox[Pathlen];
155 extern QLock mbllock;
164 /* mail subobjects */
200 #define PATH(id, f) ((((id)&0xfffff)<<10) | (f))
201 #define FILE(p) ((p) & 0x3ff)
203 /* char *dirtab[]; jpc */
205 // hash table to aid in name lookup, all files have an entry
206 typedef struct Hash Hash;
216 Hash *hlook(ulong, char*);
217 void henter(ulong, char*, Qid, Message*, Mailbox*);
218 void hfree(ulong, char*);
220 ulong msgallocd, msgfreed;