ref: d6ba06e2e7b52cec4dca754c37d15b0a690a0f2e
dir: /mail.h/
typedef struct Event Event; typedef struct Win Win; typedef struct Mesg Mesg; typedef struct Mbox Mbox; typedef struct Comp Comp; enum { Stack = 64*1024, Bufsz = 8192, Eventsz = 256*UTFmax, Subjlen = 56, }; enum { Fdummy = 1<<0, /* message placeholder */ Ftoplev = 1<<1, /* not a response to anything */ Fopen = 1<<2, /* opened for viewing */ Fresp = 1<<3, /* has been responded to */ Funseen = 1<<4, /* has been viewed */ Fdel = 1<<5, /* was deleted */ Ftodel = 1<<6, /* pending deletion */ }; enum { Vflat, Vgroup, }; struct Event { char action; char type; int q0; int q1; int flags; int ntext; char text[Eventsz + 1]; }; struct Win { Ioproc *io; Biobuf *event; int id; int ctl; int addr; int data; }; /* * In progress compositon */ struct Comp { Win; /* exec setup */ Channel *sync; int fd[2]; /* to relate back the message */ char *replyto; char *rname; char *rdigest; char **to; int nto; char **cc; int ncc; char **bcc; int nbcc; int quitting; }; /* * Message in mailbox */ struct Mesg { Win; /* bookkeeping */ char *name; int flags; u32int hash; Mesg *hnext; char quitting; /* exec setup */ Channel *sync; char *path; int fd[2]; Mesg *parent; Mesg **child; int nchild; int nsub; /* transitive children */ Mesg **attachments; int nattachments; /* info fields */ char *from; char *to; char *cc; char *replyto; char *date; char *subject; char *type; char *disposition; char *messageid; char *filename; char *digest; char *mflags; char *fromcolon; char *inreplyto; vlong time; }; /* *The mailbox we're showing. */ struct Mbox { Win; /* lock protects mesg, hash */ Mesg **mesg; Mesg **hash; int mesgsz; int hashsz; int nmesg; int ndead; Channel *see; Channel *show; Channel *event; int view; int nopen; char *path; }; extern Mbox mbox; extern int threadsort; extern int plumbsendfd; extern int plumbseemailfd; extern int plumbshowmailfd; extern int plumbsendmailfd; extern Reprog *addrpat; extern Reprog *mesgpat; /* window management */ void wininit(Win*, char*); int winopen(Win*, char*, int); Biobuf *bwinopen(Win*, char*, int); Biobuf *bwindata(Win*, int); void winclose(Win*); void wintagwrite(Win*, char*); int winevent(Win*, Event*); void winsendevent(Win*, Event*); int wineval(Win*, char*, ...); int winread(Win*, int, int, char*, int); char *matchaddr(Win*, Event*); int matchmesg(Win*, char*); char *winreadsel(Win*); void wingetsel(Win*, int*, int*); void winsetsel(Win*, int, int); /* messages */ Mesg *mblookupid(char*); Mesg *mesglookup(char*, char*); Mesg *mesgload(char*); int mesgmatch(Mesg*, char*, char*); void mesgopen(char*, char*); void mesgclear(Mesg*); void mesgfree(Mesg*); void mesgpath2name(char*, int, char*); /* mailbox */ void mbredraw(Mesg*, int, int); /* composition */ void compose(char**, int, char**, int, Mesg*, int); void compose1(char*, Mesg*, int); /* utils */ void *emalloc(ulong); void *erealloc(void*, ulong); char *estrdup(char*); char *estrjoin(char*, ...); char *esmprint(char*, ...); char *rslurp(Mesg*, char*, int*); char *fslurp(int, int*); u32int strhash(char*);