]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap: Remove content_subtype==NULL checks
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 24 Jul 2018 12:00:19 +0000 (15:00 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 25 Jan 2019 09:16:33 +0000 (11:16 +0200)
This can never happen after the previous commit. This also changes the
BODYSTRUCTURE output for invalid Content-Types, but since they're invalid
anyway it doesn't really matter what the output is.

src/lib-imap/imap-bodystructure.c

index 7a0229270517a6ac7aa8d5058bff14b66b35f2fc..4357f8791a2090dd1b911f59a97a3753fe8c06a3 100644 (file)
@@ -128,10 +128,7 @@ static void part_write_body_multipart(const struct message_part *part,
        }
 
        str_append_c(str, ' ');
-       if (data->content_subtype != NULL)
-               imap_append_string(str, data->content_subtype);
-       else
-               str_append(str, "\"x-unknown\"");
+       imap_append_string(str, data->content_subtype);
 
        if (!extended)
                return;
@@ -160,20 +157,12 @@ static void part_write_body(const struct message_part *part,
                /* "content type" "subtype" */
                if (data->content_type == NULL) {
                        text = TRUE;
-                       str_append(str, "\"text\"");
+                       str_append(str, "\"text\" \"plain\"");
                } else {
                        text = (strcasecmp(data->content_type, "text") == 0);
                        imap_append_string(str, data->content_type);
-               }
-               str_append_c(str, ' ');
-
-               if (data->content_subtype != NULL)
+                       str_append_c(str, ' ');
                        imap_append_string(str, data->content_subtype);
-               else {
-                       if (text)
-                               str_append(str, "\"plain\"");
-                       else
-                               str_append(str, "\"unknown\"");
                }
        }