From 84b60fb7811f9321996adeee827e3f99eb7be8da Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 6 Aug 2003 05:29:21 +0300 Subject: [PATCH] Don't write envelope as NIL into bodystructure even if it's broken. --HG-- branch : HEAD --- src/lib-imap/imap-bodystructure.c | 17 ++++++----------- src/lib-imap/imap-envelope.c | 8 ++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index afa3f100d8..811daf3acc 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -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); } diff --git a/src/lib-imap/imap-envelope.c b/src/lib-imap/imap-envelope.c index e6d7a0d771..610792557f 100644 --- a/src/lib-imap/imap-envelope.c +++ b/src/lib-imap/imap-envelope.c @@ -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")); -- 2.47.3