]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't write envelope as NIL into bodystructure even if it's broken.
authorTimo Sirainen <tss@iki.fi>
Wed, 6 Aug 2003 02:29:21 +0000 (05:29 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 6 Aug 2003 02:29:21 +0000 (05:29 +0300)
--HG--
branch : HEAD

src/lib-imap/imap-bodystructure.c
src/lib-imap/imap-envelope.c

index afa3f100d823268f30b9d79286ca715b41b5a438..811daf3acc15bdf872e0031cf256dc17af633e38 100644 (file)
@@ -420,23 +420,18 @@ static void part_write_body(struct message_part *part,
        } else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
                /* message/rfc822 contains envelope + body + line count */
                struct message_part_body_data *child_data;
+                struct message_part_envelope_data *env_data;
 
                i_assert(part->children != NULL);
                i_assert(part->children->next == NULL);
 
                 child_data = part->children->context;
+               env_data = child_data != NULL ? child_data->envelope : NULL;
+
+               str_append_c(str, " (");
+               imap_envelope_write_part_data(env_data, str);
+               str_append(str, ") ");
 
-               str_append_c(str, ' ');
-               if (child_data != NULL && child_data->envelope != NULL) {
-                       str_append_c(str, '(');
-                       imap_envelope_write_part_data(child_data->envelope,
-                                                     str);
-                       str_append_c(str, ')');
-               } else {
-                       /* buggy message */
-                       str_append(str, "NIL");
-               }
-               str_append_c(str, ' ');
                part_write_bodystructure(part->children, str, extended);
                str_printfa(str, " %u", part->body_size.lines);
        }
index e6d7a0d77177548ba1a049f8584dc4ccc4ab36fa..610792557f73afd3b7f6cd55d4bf3d539d8e3d02 100644 (file)
@@ -173,6 +173,14 @@ static void imap_write_address(string_t *str, struct message_address *addr)
 void imap_envelope_write_part_data(struct message_part_envelope_data *data,
                                   string_t *str)
 {
+       static const char *empty_envelope =
+               "NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL";
+
+       if (data == NULL) {
+               str_append(str, empty_envelope);
+               return;
+       }
+
        str_append(str, NVL(data->date, "NIL"));
        str_append_c(str, ' ');
        str_append(str, NVL(data->subject, "NIL"));