From 1190a7aa7a1dba5964688c4bb8ee09fc8930c488 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 3 Mar 2006 14:13:22 +0000 Subject: more updates --- src/cmd/acme/mail/dat.h | 1 + src/cmd/acme/mail/mesg.c | 5 +++++ src/cmd/acme/mail/reply.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+) (limited to 'src/cmd/acme/mail') diff --git a/src/cmd/acme/mail/dat.h b/src/cmd/acme/mail/dat.h index 1b374966..01d685be 100644 --- a/src/cmd/acme/mail/dat.h +++ b/src/cmd/acme/mail/dat.h @@ -61,6 +61,7 @@ struct Message uchar tagposted; uchar recursed; uchar level; + uint replywinid; /* header info */ char *from; diff --git a/src/cmd/acme/mail/mesg.c b/src/cmd/acme/mail/mesg.c index 55a65b4a..0d894d93 100644 --- a/src/cmd/acme/mail/mesg.c +++ b/src/cmd/acme/mail/mesg.c @@ -347,6 +347,11 @@ readfile(char *dir, char *name, int *np) free(d); data = emalloc(len+1); len = fsreadn(fid, data, len); + if(len <= 0){ + fsclose(fid); + free(data); + return nil; + } fsclose(fid); if(np != nil) *np = len; diff --git a/src/cmd/acme/mail/reply.c b/src/cmd/acme/mail/reply.c index c28e15f1..a44441c8 100644 --- a/src/cmd/acme/mail/reply.c +++ b/src/cmd/acme/mail/reply.c @@ -70,12 +70,25 @@ quote(Message *m, CFid *fid, char *dir, char *quotetext) void mkreply(Message *m, char *label, char *to, Plumbattr *attr, char *quotetext) { + char buf[100]; + CFid *fd; Message *r; char *dir, *t; int quotereply; Plumbattr *a; quotereply = (label[0] == 'Q'); + + if(quotereply && m && m->replywinid > 0){ + snprint(buf, sizeof buf, "%d/body", m->replywinid); + if((fd = fsopen(acmefs, buf, OWRITE)) != nil){ + dir = estrstrdup(mbox.name, m->name); + quote(m, fd, dir, quotetext); + free(dir); + return; + } + } + r = emalloc(sizeof(Message)); r->isreply = 1; if(m != nil) @@ -90,6 +103,8 @@ mkreply(Message *m, char *label, char *to, Plumbattr *attr, char *quotetext) r->name = emalloc(strlen(mbox.name)+strlen(label)+10); sprint(r->name, "%s%s%d", mbox.name, label, ++replyid); r->w = newwindow(); + if(m) + m->replywinid = r->w->id; winname(r->w, r->name); ctlprint(r->w->ctl, "cleartag"); wintagwrite(r->w, "fmt Look Post Undo", 4+5+5+4); -- cgit v1.2.3