diff options
author | rsc <devnull@localhost> | 2006-02-28 00:49:05 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-02-28 00:49:05 +0000 |
commit | 0d42cc9dcba5ca319a2cdb885811084856319dd3 (patch) | |
tree | c7d3678d090af817f9de82799e18e20128bd76a2 /src/cmd/acme | |
parent | 06d255079ae3c99ea1e980f85a4386f150d22e44 (diff) | |
download | plan9port-0d42cc9dcba5ca319a2cdb885811084856319dd3.tar.gz plan9port-0d42cc9dcba5ca319a2cdb885811084856319dd3.tar.bz2 plan9port-0d42cc9dcba5ca319a2cdb885811084856319dd3.zip |
new delmesg
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/mail/dat.h | 1 | ||||
-rw-r--r-- | src/cmd/acme/mail/mail.c | 28 | ||||
-rw-r--r-- | src/cmd/acme/mail/mesg.c | 2 |
3 files changed, 18 insertions, 13 deletions
diff --git a/src/cmd/acme/mail/dat.h b/src/cmd/acme/mail/dat.h index 87d4e7b0..1b374966 100644 --- a/src/cmd/acme/mail/dat.h +++ b/src/cmd/acme/mail/dat.h @@ -138,6 +138,7 @@ extern void mesgmenumarkdel(Window*, Message*, Message*, int); extern Message* mesglookup(Message*, char*, char*); extern Message* mesglookupfile(Message*, char*, char*); extern void mesgfreeparts(Message*); +extern int mesgcommand(Message*, char*); extern char* readfile(char*, char*, int*); extern char* readbody(char*, char*, int*); diff --git a/src/cmd/acme/mail/mail.c b/src/cmd/acme/mail/mail.c index f8030ca4..988c53c2 100644 --- a/src/cmd/acme/mail/mail.c +++ b/src/cmd/acme/mail/mail.c @@ -310,15 +310,22 @@ showmesg(char *name, char *digest) } void -delmesg(char *name, char *digest, int dodel) +delmesg(char *name, char *digest, int dodel, char *save) { Message *m; m = mesglookupfile(&mbox, name, digest); if(m != nil){ - mesgmenumarkdel(wbox, &mbox, m, 0); + if(save) + mesgcommand(m, estrstrdup("Save ", save)); if(dodel) - m->writebackdel = 1; + mesgmenumarkdel(wbox, &mbox, m, 1); + else{ + /* notification came from plumber - message is gone */ + mesgmenudel(wbox, &mbox, m); + if(!m->opened) + mesgdel(&mbox, m); + } } } @@ -339,7 +346,7 @@ plumbthread(void) else if(strcmp(type, "new") == 0) newmesg(m->data, digest); else if(strcmp(type, "delete") == 0) - delmesg(m->data, digest, 0); + delmesg(m->data, digest, 0, nil); else fprint(2, "Mail: unknown plumb attribute %s\n", type); plumbfree(m); @@ -378,7 +385,7 @@ plumbsendthread(void *v) int mboxcommand(Window *w, char *s) { - char *args[10], **targs; + char *args[10], **targs, *save; Message *m, *next; int ok, nargs, i, j; char buf[128]; @@ -430,12 +437,9 @@ mboxcommand(Window *w, char *s) return 1; } if(strcmp(s, "Delmesg") == 0){ - if(nargs > 1){ - for(i=1; i<nargs; i++){ - snprint(buf, sizeof buf, "%s%s", mbox.name, args[i]); - delmesg(buf, nil, 1); - } - } + save = nil; + if(nargs > 1) + save = args[1]; s = winselection(w); if(s == nil) return 1; @@ -452,7 +456,7 @@ mboxcommand(Window *w, char *s) if(j == 0) continue; snprint(buf, sizeof buf, "%s%d", mbox.name, j); - delmesg(buf, nil, 1); + delmesg(buf, nil, 1, save); } free(s); free(targs); diff --git a/src/cmd/acme/mail/mesg.c b/src/cmd/acme/mail/mesg.c index 2beedb05..55a65b4a 100644 --- a/src/cmd/acme/mail/mesg.c +++ b/src/cmd/acme/mail/mesg.c @@ -552,7 +552,7 @@ mesgmenudel(Window *w, Message *mbox, Message *m) fsclose(w->addr); w->addr = nil; w->data = nil; - mbox->dirty = 1; +/* assume caller knows best mbox->dirty = 1; */ m->deleted = 1; } |