mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
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.
This commit is contained in:
parent
e20dcb151a
commit
491fe25158
1 changed files with 10 additions and 10 deletions
|
@ -136,7 +136,7 @@ mesgload(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mesg*
|
static Mesg*
|
||||||
readparts(Mesg *m)
|
readparts(Mesg *r, Mesg *m)
|
||||||
{
|
{
|
||||||
char *dpath, *apath;
|
char *dpath, *apath;
|
||||||
int n, i, dfd;
|
int n, i, dfd;
|
||||||
|
@ -168,18 +168,18 @@ readparts(Mesg *m)
|
||||||
if(a == nil)
|
if(a == nil)
|
||||||
continue;
|
continue;
|
||||||
if(strncmp(a->type, "multipart/", strlen("multipart/")) == 0){
|
if(strncmp(a->type, "multipart/", strlen("multipart/")) == 0){
|
||||||
sub = readparts(a);
|
sub = readparts(r, a);
|
||||||
if(sub != a)
|
if(sub != a)
|
||||||
m->body = sub;
|
m->body = sub;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(m->nparts >= m->xparts)
|
if(r->nparts >= r->xparts)
|
||||||
m->parts = erealloc(m->parts, (2 + m->nparts*2)*sizeof(Mesg*));
|
r->parts = erealloc(r->parts, (2 + r->nparts*2)*sizeof(Mesg*));
|
||||||
m->parts[m->nparts++] = a;
|
r->parts[r->nparts++] = a;
|
||||||
if(m->body == nil && strcmp(a->type, "text/plain") == 0)
|
if(r->body == nil && strcmp(a->type, "text/plain") == 0)
|
||||||
m->body = a;
|
r->body = a;
|
||||||
else if(m->body == nil && strcmp(a->type, "text/html") == 0)
|
else if(r->body == nil && strcmp(a->type, "text/html") == 0)
|
||||||
m->body = a;
|
r->body = a;
|
||||||
}
|
}
|
||||||
free(d);
|
free(d);
|
||||||
if(m->body == nil)
|
if(m->body == nil)
|
||||||
|
@ -532,7 +532,7 @@ mesgopenbody(Mesg *m)
|
||||||
int rfd;
|
int rfd;
|
||||||
Mesg *b;
|
Mesg *b;
|
||||||
|
|
||||||
b = readparts(m);
|
b = readparts(m, m);
|
||||||
path = estrjoin(mbox.path, b->name, "body", nil);
|
path = estrjoin(mbox.path, b->name, "body", nil);
|
||||||
if(strcmp(b->type, "text/html") == 0)
|
if(strcmp(b->type, "text/html") == 0)
|
||||||
rfd = htmlfmt(m, path);
|
rfd = htmlfmt(m, path);
|
||||||
|
|
Loading…
Reference in a new issue