* Reversed previous change. It wasn't needed after all.
authorArt Cancro <ajc@citadel.org>
Thu, 23 Aug 2007 19:28:20 +0000 (19:28 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 23 Aug 2007 19:28:20 +0000 (19:28 +0000)
* Removed an extra 'NIL' (content language, I guess) from multipart trailer.
  This doesn't appear to be needed either.

citadel/modules/imap/imap_fetch.c

index 1e026ba939a2765345836dda20d82b7d52f98bab..3af4e8cb7447533f631861acd4eb5d39cc14c287 100644 (file)
@@ -751,7 +751,7 @@ void imap_fetch_bodystructure_post(
        imap_strout(subtype);
 
        /* body language */
-       cprintf(" NIL");
+       /* cprintf(" NIL"); We thought we needed this at one point, but maybe we don't... */
 
        cprintf(")");
 }
@@ -774,7 +774,6 @@ 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) {
@@ -786,51 +785,36 @@ 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);
+       imap_strout(cbmaintype);                                        /* body type */
        cprintf(" ");
-       imap_strout(cbsubtype);
+       imap_strout(cbsubtype);                                         /* body subtype */
        cprintf(" ");
 
+       cprintf("(");                                                   /* begin body parameter list */
+
+       if (name != NULL) if (!IsEmptyStr(name)) {
+               cprintf("\"NAME\" ");
+               imap_strout(name);
+               cprintf(" ");
+       }
+
+       cprintf("\"CHARSET\" ");
        if (cbcharset == NULL) {
-               cprintf("(\"CHARSET\" \"US-ASCII\"");
+               imap_strout("US-ASCII");
        }
-       else if (IsEmptyStr(cbcharset)) {
-               cprintf("(\"CHARSET\" \"US-ASCII\"");
+       else if (cbcharset[0] == 0) {
+               imap_strout("US-ASCII");
        }
        else {
-               cprintf("(\"CHARSET\" ");
                imap_strout(cbcharset);
        }
+       cprintf(") ");                                                  /* end body parameter list */
 
-       if (name != NULL) if (!IsEmptyStr(name)) {
-               cprintf(" \"NAME\" ");
-               imap_strout(name);
-       }
-
-       cprintf(") ");
-
-       cprintf("NIL ");        /* Body ID */
-       cprintf("NIL ");        /* Body description */
+       cprintf("NIL ");                                                /* Body ID */
+       cprintf("NIL ");                                                /* Body description */
 
-       if (encoding != NULL) if (!IsEmptyStr(encoding))  have_encoding = 1;
+       if (encoding != NULL) if (encoding[0] != 0)  have_encoding = 1;
        if (have_encoding) {
                imap_strout(encoding);
        }