diff options
author | rsc <devnull@localhost> | 2006-05-06 22:53:44 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-05-06 22:53:44 +0000 |
commit | 53af1186ca6d4e0560837ed19535ca38a6069201 (patch) | |
tree | 9e2311048571488daf768d2fc9ba3f5c89271a76 /src | |
parent | 95d412d4bca1e7855818e09ee5afa260e6356504 (diff) | |
download | plan9port-53af1186ca6d4e0560837ed19535ca38a6069201.tar.gz plan9port-53af1186ca6d4e0560837ed19535ca38a6069201.tar.bz2 plan9port-53af1186ca6d4e0560837ed19535ca38a6069201.zip |
show full name in from
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/acme/mail/dat.h | 1 | ||||
-rw-r--r-- | src/cmd/acme/mail/mesg.c | 31 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/cmd/acme/mail/dat.h b/src/cmd/acme/mail/dat.h index a8321649..4b5c23c7 100644 --- a/src/cmd/acme/mail/dat.h +++ b/src/cmd/acme/mail/dat.h @@ -65,6 +65,7 @@ struct Message /* header info */ char *from; + char *fromcolon; char *to; char *cc; char *replyto; diff --git a/src/cmd/acme/mail/mesg.c b/src/cmd/acme/mail/mesg.c index 1ba19c24..8e8443be 100644 --- a/src/cmd/acme/mail/mesg.c +++ b/src/cmd/acme/mail/mesg.c @@ -80,7 +80,7 @@ line(char *data, char **pp) } static char* -mkaddrs(char *t) +mkaddrs(char *t, char **colon) { int i, nf, inquote; char **f, *s; @@ -96,14 +96,23 @@ mkaddrs(char *t) } f = emalloc(nf*sizeof f[0]); nf = tokenize(t, f, nf); + if(colon){ + fmtstrinit(&fmt); + for(i=0; i+1<nf; i+=2){ + if(i > 0) + fmtprint(&fmt, ", "); + if(f[i][0] == 0 || strcmp(f[i], f[i+1]) == 0) + fmtprint(&fmt, "%s", f[i+1]); + else + fmtprint(&fmt, "%s <%s>", f[i], f[i+1]); + } + *colon = fmtstrflush(&fmt); + } fmtstrinit(&fmt); for(i=0; i+1<nf; i+=2){ if(i > 0) fmtprint(&fmt, ", "); - /* if(f[i][0] == 0 || strcmp(f[i], f[i+1]) == 0) */ - fmtprint(&fmt, "%s", f[i+1]); - /* else */ - /* fmtprint(&fmt, "%s <%s>", f[i], f[i+1]); */ + fmtprint(&fmt, "%s", f[i+1]); } free(f); return fmtstrflush(&fmt); @@ -127,19 +136,19 @@ loadinfo(Message *m, char *dir) *t++ = 0; if(strcmp(s, "from") == 0){ free(m->from); - m->from = mkaddrs(t); + m->from = mkaddrs(t, &m->fromcolon); }else if(strcmp(s, "sender") == 0){ free(m->sender); - m->sender = mkaddrs(t); + m->sender = mkaddrs(t, nil); }else if(strcmp(s, "to") == 0){ free(m->to); - m->to = mkaddrs(t); + m->to = mkaddrs(t, nil); }else if(strcmp(s, "cc") == 0){ free(m->cc); - m->cc = mkaddrs(t); + m->cc = mkaddrs(t, nil); }else if(strcmp(s, "replyto") == 0){ free(m->replyto); - m->replyto = mkaddrs(t); + m->replyto = mkaddrs(t, nil); }else if(strcmp(s, "subject") == 0){ free(m->subject); m->subject = estrdup(t); @@ -369,7 +378,7 @@ info(Message *m, int ind, int ogf) if (ogf) p=m->to; else - p=m->from; + p=m->fromcolon; if(ind==0 && shortmenu){ len = 30; |