[dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.47,1.48

cras at dovecot.org cras at dovecot.org
Sun Jul 18 05:25:08 EEST 2004


Update of /home/cvs/dovecot/src/lib-imap
In directory talvi:/tmp/cvs-serv3398/lib-imap

Modified Files:
	imap-bodystructure.c 
Log Message:
Header caching redesigned. New design allows caching decisions per field, so
they can be divided to temporary/permanent. Cached headers are now always
returned in original order, old code didn't guarantee it. Some other caching
changes. (still missing code to store changes in caching decisions)



Index: imap-bodystructure.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-bodystructure.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- imap-bodystructure.c	8 Jul 2004 20:26:15 -0000	1.47
+++ imap-bodystructure.c	18 Jul 2004 02:25:06 -0000	1.48
@@ -350,24 +350,27 @@
 			    string_t *str, int extended)
 {
 	struct message_part_body_data *data = part->context;
+	int text;
 
 	if (data == NULL) {
 		/* there was no content headers, use an empty structure */
 		data = t_new(struct message_part_body_data, 1);
 	}
 
-	if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822)
+	if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
 		str_append(str, "\"message\" \"rfc822\"");
-	else {
+		text = FALSE;
+	} else {
 		/* "content type" "subtype" */
+		text = data->content_type == NULL ||
+			strcasecmp(data->content_type, "\"text\"") == 0;
 		str_append(str, NVL(data->content_type, "\"text\""));
 		str_append_c(str, ' ');
 
 		if (data->content_subtype != NULL)
 			str_append(str, data->content_subtype);
 		else {
-			if (data->content_type == NULL ||
-			    strcasecmp(data->content_type, "\"text\"") == 0)
+			if (text)
 				str_append(str, "\"plain\"");
 			else
 				str_append(str, "\"unknown\"");
@@ -378,8 +381,7 @@
 	/* ("content type param key" "value" ...) */
 	str_append_c(str, ' ');
 	if (data->content_type_params == NULL) {
-		if (data->content_type != NULL &&
-		    strncasecmp(data->content_type, "\"text\"", 6) != 0)
+		if (!text)
 			str_append(str, "NIL");
 		else
 			str_append(str, "("DEFAULT_CHARSET")");
@@ -395,7 +397,7 @@
 		    NVL(data->content_transfer_encoding, "\"7bit\""),
 		    part->body_size.virtual_size);
 
-	if (part->flags & MESSAGE_PART_FLAG_TEXT) {
+	if (text) {
 		/* text/.. contains line count */
 		str_printfa(str, " %u", part->body_size.lines);
 	} else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {



More information about the dovecot-cvs mailing list