From: Art Cancro Date: Thu, 23 Aug 2007 17:00:13 +0000 (+0000) Subject: imap_fetch.c: output an extra space required before the X-Git-Tag: v7.86~3122 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=e4e72be8bd8c1ea356357a50fc04b765d97c0dfb imap_fetch.c: output an extra space required before the second and subsequent components of a multipart sequence when outputting BODYSTRUCTURE. C-Client (in this case, Asterisk) chokes when that space isn't there. --- 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(" ");