diff options
author | rsc <devnull@localhost> | 2006-02-11 22:35:38 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-02-11 22:35:38 +0000 |
commit | 00d75e0eaefc3d52a6bb631e4747da2b88e7c393 (patch) | |
tree | 22442f206af78a40ab03d3d52f74f53f70a6ced6 /src/cmd/acme/mail | |
parent | 0c7c441e9033e523b96b474cdbee6b63410805f9 (diff) | |
download | plan9port-00d75e0eaefc3d52a6bb631e4747da2b88e7c393.tar.gz plan9port-00d75e0eaefc3d52a6bb631e4747da2b88e7c393.tar.bz2 plan9port-00d75e0eaefc3d52a6bb631e4747da2b88e7c393.zip |
more changes
Diffstat (limited to 'src/cmd/acme/mail')
-rw-r--r-- | src/cmd/acme/mail/dat.h | 4 | ||||
-rw-r--r-- | src/cmd/acme/mail/mail.c | 44 | ||||
-rw-r--r-- | src/cmd/acme/mail/mesg.c | 12 | ||||
-rw-r--r-- | src/cmd/acme/mail/mkfile | 17 |
4 files changed, 29 insertions, 48 deletions
diff --git a/src/cmd/acme/mail/dat.h b/src/cmd/acme/mail/dat.h index 9bf483c2..c601ac19 100644 --- a/src/cmd/acme/mail/dat.h +++ b/src/cmd/acme/mail/dat.h @@ -153,8 +153,8 @@ extern Window *wbox; extern Message mbox; extern Message replies; extern char *fsname; -extern int plumbsendfd; -extern int plumbseemailfd; +extern CFid *plumbsendfd; +extern CFid *plumbseemailfd; extern char *home; extern char *outgoing; extern char *mailboxdir; diff --git a/src/cmd/acme/mail/mail.c b/src/cmd/acme/mail/mail.c index 0ce7ac97..83238598 100644 --- a/src/cmd/acme/mail/mail.c +++ b/src/cmd/acme/mail/mail.c @@ -2,13 +2,13 @@ #include <libc.h> #include <bio.h> #include <thread.h> +#include <9pclient.h> #include <plumb.h> #include <ctype.h> -#include <9pclient.h> #include "dat.h" -char *maildir = "/mail/"; /* mountpoint of mail file system */ -char *mboxname = "INBOX"; /* mailboxdir/mboxname is mail spool file */ +char *maildir = "Mail/"; /* mountpoint of mail file system */ +char *mboxname = "mbox"; /* mailboxdir/mboxname is mail spool file */ char *mailboxdir = nil; /* nil == /mail/box/$user */ char *fsname; /* filesystem for mailboxdir/mboxname is at maildir/fsname */ char *user; @@ -18,10 +18,10 @@ Window *wbox; Message mbox; Message replies; char *home; -int plumbsendfd; -int plumbseemailfd; -int plumbshowmailfd; -int plumbsendmailfd; +CFid *plumbsendfd; +CFid *plumbseemailfd; +CFid *plumbshowmailfd; +CFid *plumbsendmailfd; Channel *cplumb; Channel *cplumbshow; Channel *cplumbsend; @@ -85,9 +85,9 @@ threadmain(int argc, char *argv[]) quotefmtinstall(); /* open these early so we won't miss notification of new mail messages while we read mbox */ - plumbsendfd = plumbopen("send", OWRITE|OCEXEC); - plumbseemailfd = plumbopen("seemail", OREAD|OCEXEC); - plumbshowmailfd = plumbopen("showmail", OREAD|OCEXEC); + plumbsendfd = plumbopenfid("send", OWRITE|OCEXEC); + plumbseemailfd = plumbopenfid("seemail", OREAD|OCEXEC); + plumbshowmailfd = plumbopenfid("showmail", OREAD|OCEXEC); shortmenu = 0; ARGBEGIN{ @@ -114,7 +114,7 @@ threadmain(int argc, char *argv[]) if(mailfs == nil) error("cannot mount mail: %r"); - name = "INBOX"; + name = "mbox"; newdir = 1; if(argc > 0){ @@ -159,9 +159,9 @@ threadmain(int argc, char *argv[]) if(outgoing == nil) outgoing = estrstrdup(mailboxdir, "/outgoing"); - mbox.ctlfd = fsopen(mailfs, "INBOX/ctl", OWRITE); + mbox.ctlfd = fsopen(mailfs, "mbox/ctl", OWRITE); if(mbox.ctlfd == nil) - error("can't open %s: %r", "INBOX/ctl"); + error("can't open %s: %r", "mbox/ctl"); fsname = estrdup(name); if(newdir && argc > 0){ @@ -216,12 +216,12 @@ threadmain(int argc, char *argv[]) wctlfd = -1; cplumb = chancreate(sizeof(Plumbmsg*), 0); cplumbshow = chancreate(sizeof(Plumbmsg*), 0); - if(strcmp(name, "INBOX") == 0){ + if(strcmp(name, "mbox") == 0){ /* * Avoid creating multiple windows to send mail by only accepting * sendmail plumb messages if we're reading the main mailbox. */ - plumbsendmailfd = plumbopen("sendmail", OREAD|OCEXEC); + plumbsendmailfd = plumbopenfid("sendmail", OREAD|OCEXEC); cplumbsend = chancreate(sizeof(Plumbmsg*), 0); proccreate(plumbsendproc, nil, STACK); threadcreate(plumbsendthread, nil, STACK); @@ -241,7 +241,7 @@ plumbproc(void* v) threadsetname("plumbproc"); for(;;){ - m = plumbrecv(plumbseemailfd); + m = plumbrecvfid(plumbseemailfd); sendp(cplumb, m); if(m == nil) threadexits(nil); @@ -255,7 +255,7 @@ plumbshowproc(void* v) threadsetname("plumbshowproc"); for(;;){ - m = plumbrecv(plumbshowmailfd); + m = plumbrecvfid(plumbshowmailfd); sendp(cplumbshow, m); if(m == nil) threadexits(nil); @@ -269,7 +269,7 @@ plumbsendproc(void* v) threadsetname("plumbsendproc"); for(;;){ - m = plumbrecv(plumbsendmailfd); + m = plumbrecvfid(plumbsendmailfd); sendp(cplumbsend, m); if(m == nil) threadexits(nil); @@ -285,8 +285,8 @@ newmesg(char *name, char *digest) return; /* message is about another mailbox */ if(mesglookupfile(&mbox, name, digest) != nil) return; - if(strncmp(name, "/mail/", 6) == 0) - name += 6; + if(strncmp(name, "Mail/", 5) == 0) + name += 5; d = fsdirstat(mailfs, name); if(d == nil) return; @@ -300,10 +300,8 @@ showmesg(char *name, char *digest) { char *n; char *mb; - + mb = mbox.name; - if(strncmp(mb, "/mail/", 6) == 0) - mb += 6; if(strncmp(name, mb, strlen(mb)) != 0) return; /* message is about another mailbox */ n = estrdup(name+strlen(mb)); diff --git a/src/cmd/acme/mail/mesg.c b/src/cmd/acme/mail/mesg.c index 29f6bb59..d54b7fb2 100644 --- a/src/cmd/acme/mail/mesg.c +++ b/src/cmd/acme/mail/mesg.c @@ -3,8 +3,8 @@ #include <bio.h> #include <thread.h> #include <ctype.h> -#include <plumb.h> #include <9pclient.h> +#include <plumb.h> #include "dat.h" enum @@ -200,9 +200,9 @@ isnumeric(char *s) CFid* mailopen(char *name, int mode) { - if(strncmp(name, "/mail/", 6) != 0) + if(strncmp(name, "Mail/", 5) != 0) return nil; - return fsopen(mailfs, name+6, mode); + return fsopen(mailfs, name+5, mode); } Dir* @@ -624,7 +624,7 @@ mesgsave(Message *m, char *s, int save) char *t, *raw, *unixheader, *all; if(save){ - if(fsprint(mbox.ctlfd, "save %q %q", m->name, s) < 0){ + if(fsprint(mbox.ctlfd, "save %q %q", s, m->name) < 0){ fprint(2, "Mail: can't save %s to %s: %r\n", m->name, s); return 0; } @@ -865,7 +865,7 @@ replytoaddr(Window *w, Message *m, Event *e, char *s) pm->attr->value = estrdup(m->subject); pm->attr->next = nil; } - if(plumbsend(plumbsendfd, pm) < 0) + if(plumbsendtofid(plumbsendfd, pm) < 0) fprint(2, "error writing plumb message: %r\n"); plumbfree(pm); } @@ -1253,7 +1253,7 @@ plumb(Message *m, char *dir) pm->ndata = -1; pm->data = estrstrdup(dir, "body"); pm->data = eappend(pm->data, "", ports[i].suffix); - if(plumbsend(plumbsendfd, pm) < 0) + if(plumbsendtofid(plumbsendfd, pm) < 0) fprint(2, "error writing plumb message: %r\n"); plumbfree(pm); } diff --git a/src/cmd/acme/mail/mkfile b/src/cmd/acme/mail/mkfile index 0a7fe0e0..d95e1b21 100644 --- a/src/cmd/acme/mail/mkfile +++ b/src/cmd/acme/mail/mkfile @@ -1,7 +1,5 @@ <$PLAN9/src/mkhdr -CC=9c - TARG=Mail OFILES=\ html.$O\ @@ -12,21 +10,6 @@ OFILES=\ win.$O HFILES=dat.h -LIB= - -BIN=/acme/bin/$objtype - -UPDATE=\ - mkfile\ - $HFILES\ - ${OFILES:%.$O=%.c}\ <$PLAN9/src/mkone -$O.out: $OFILES - $LD -o $target $LDFLAGS $OFILES - -syms:V: - 8c -a mail.c >syms - 8c -aa mesg.c reply.c util.c win.c >>syms - |