X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fimap%2Fimap_fetch.c;h=1e026ba939a2765345836dda20d82b7d52f98bab;hb=e4e72be8bd8c1ea356357a50fc04b765d97c0dfb;hp=49818e4387b5de52b4d3513928d7498b96161e32;hpb=10b70c391b903b3fda30722face1d3a6db7ef088;p=citadel.git diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 49818e438..1e026ba93 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -774,6 +774,7 @@ void imap_fetch_bodystructure_part( size_t i; char cbmaintype[128]; char cbsubtype[128]; + char iteration[128]; if (cbtype != NULL) if (!IsEmptyStr(cbtype)) have_cbtype = 1; if (have_cbtype) { @@ -785,6 +786,23 @@ void imap_fetch_bodystructure_part( strcpy(cbsubtype, "PLAIN"); } + /* If this is the second or subsequent part of a multipart sequence, + * we need to output another space here. We do this by obtaining the + * last subpart token of the partnum and converting it to a number. + */ + if (strrchr(partnum, '.')) { + safestrncpy(iteration, (strrchr(partnum, '.')+1), sizeof iteration); + } + else { + safestrncpy(iteration, partnum, sizeof iteration); + } + if (atoi(iteration) > 1) { + cprintf(" "); + } + + + /* output loop */ + cprintf("("); imap_strout(cbmaintype); cprintf(" ");