summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-02-07 20:30:04 -0800
committerOri Bernstein <ori@eigenstate.org>2021-02-07 20:30:04 -0800
commit491fe2515890fc4e624af72f15775fd48510486a (patch)
tree9503279b16c5c9da3e6bbf19800e5f0a7a56a07f
parente20dcb151ac7fdd1673b02c144c0a22ae407452b (diff)
downloadplan9front-491fe2515890fc4e624af72f15775fd48510486a.tar.xz
Mail: correct rendering of nested multipart messages
Reading nested subparts of messages into the root message array allows deeply nested multipart trees of messages to show correctly in the message view.
-rw-r--r--sys/src/cmd/upas/Mail/mesg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/src/cmd/upas/Mail/mesg.c b/sys/src/cmd/upas/Mail/mesg.c
index fdcc01921..83e9e5feb 100644
--- a/sys/src/cmd/upas/Mail/mesg.c
+++ b/sys/src/cmd/upas/Mail/mesg.c
@@ -136,7 +136,7 @@ mesgload(char *name)
}
static Mesg*
-readparts(Mesg *m)
+readparts(Mesg *r, Mesg *m)
{
char *dpath, *apath;
int n, i, dfd;
@@ -168,18 +168,18 @@ readparts(Mesg *m)
if(a == nil)
continue;
if(strncmp(a->type, "multipart/", strlen("multipart/")) == 0){
- sub = readparts(a);
+ sub = readparts(r, a);
if(sub != a)
m->body = sub;
continue;
}
- if(m->nparts >= m->xparts)
- m->parts = erealloc(m->parts, (2 + m->nparts*2)*sizeof(Mesg*));
- m->parts[m->nparts++] = a;
- if(m->body == nil && strcmp(a->type, "text/plain") == 0)
- m->body = a;
- else if(m->body == nil && strcmp(a->type, "text/html") == 0)
- m->body = a;
+ if(r->nparts >= r->xparts)
+ r->parts = erealloc(r->parts, (2 + r->nparts*2)*sizeof(Mesg*));
+ r->parts[r->nparts++] = a;
+ if(r->body == nil && strcmp(a->type, "text/plain") == 0)
+ r->body = a;
+ else if(r->body == nil && strcmp(a->type, "text/html") == 0)
+ r->body = a;
}
free(d);
if(m->body == nil)
@@ -532,7 +532,7 @@ mesgopenbody(Mesg *m)
int rfd;
Mesg *b;
- b = readparts(m);
+ b = readparts(m, m);
path = estrjoin(mbox.path, b->name, "body", nil);
if(strcmp(b->type, "text/html") == 0)
rfd = htmlfmt(m, path);