[dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.40,1.41 imap-envelope.c,1.29,1.30

cras at procontrol.fi cras at procontrol.fi
Wed Aug 6 06:29:23 EEST 2003


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv5586

Modified Files:
	imap-bodystructure.c imap-envelope.c 
Log Message:
Don't write envelope as NIL into bodystructure even if it's broken.



Index: imap-bodystructure.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-bodystructure.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- imap-bodystructure.c	5 Aug 2003 23:10:33 -0000	1.40
+++ imap-bodystructure.c	6 Aug 2003 02:29:21 -0000	1.41
@@ -420,23 +420,18 @@
 	} 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: imap-envelope.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-envelope.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- imap-envelope.c	2 Jul 2003 00:57:25 -0000	1.29
+++ imap-envelope.c	6 Aug 2003 02:29:21 -0000	1.30
@@ -173,6 +173,14 @@
 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"));



More information about the dovecot-cvs mailing list