bug fixes:

list message 1.
give correct contents for raw, rawheader, rawbody.
provide filename and charset in mime attachments.
only rename mailboxes named mbox* not mbox*.
This commit is contained in:
rsc 2007-06-23 06:12:50 +00:00
parent 9ec386fef4
commit bb70a84b1f
2 changed files with 16 additions and 2 deletions

View file

@ -55,6 +55,7 @@ enum
Qdesc,
Qencoding, /* only here temporarily! */
Qcharset,
Qfilename,
Qraw,
Qrawheader,
Qrawbody,
@ -69,7 +70,6 @@ enum
Qheader,
Qdigest,
Qdisposition,
Qfilename,
Qflags,
Qinfo,
Qrawunix,
@ -488,6 +488,7 @@ filedata(int type, Box *box, Msg *msg, Part *part, char **pp, int *len, int *fre
case Qdesc:
case Qencoding:
case Qcharset:
case Qfilename:
case Qraw:
case Qrawheader:
case Qrawbody:
@ -772,6 +773,7 @@ boxgen(int i, Dir *d, void *aux)
i--;
if(i == 0)
return filldir(d, Qsearch, box, nil, nil);
i--;
if(i < box->nsub)
return filldir(d, Qbox, box->sub[i], nil, nil);
i -= box->nsub;
@ -798,6 +800,8 @@ static int mimemsgdir[] = {
static int mimedir[] = {
Qtype,
Qbody,
Qfilename,
Qcharset,
Qmimeheader,
Qraw
};

View file

@ -1201,6 +1201,14 @@ unexpected(Imap *z, Sx *sx)
}
}
static int
alldollars(char *s)
{
for(; *s; s++)
if(*s != '$')
return 0;
return 1;
}
static void
xlist(Imap *z, Sx *sx)
@ -1220,7 +1228,7 @@ xlist(Imap *z, Sx *sx)
* Rename any existing mbox by appending a $.
*/
inbox = 0;
if(strncmp(s, "mbox", 4) == 0){
if(strncmp(s, "mbox", 4) == 0 && alldollars(s+4)){
t = emalloc(strlen(s)+2);
strcpy(t, s);
strcat(t, "$");
@ -1588,6 +1596,7 @@ xmsgbodydata(Msg *msg, Sx *k, Sx *v)
/* now name is something like 1 or 3.2.MIME - walk down parts from root */
part = msg->part[0];
while('1' <= name[0] && name[0] <= '9'){
i = strtol(name, &p, 10);
if(*p == '.')
@ -1603,6 +1612,7 @@ xmsgbodydata(Msg *msg, Sx *k, Sx *v)
name = p;
}
if(cistrcmp(name, "") == 0){
free(part->raw);
part->raw = nstring(v);