Re: [evolution-patches] patch for bug #69145




Here's another version, this fixes the check to see if the content is complex - it was using incomplete content-info as a guide.

Seems to work quite well on cyrus (even if incremental getting is actually slower ...).

Michael

On Mon, 2004-11-08 at 10:35 -0500, Jeffrey Stedfast wrote:
I like this fix better too


--
Michael Zucchi <notzed ximian com>
"I'm stuck in a reality I can't imagine could be real."
Novell's Evolution and Free Software Developer
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251.2.19
diff -u -p -r1.2251.2.19 ChangeLog
--- camel/ChangeLog	27 Oct 2004 06:15:46 -0000	1.2251.2.19
+++ camel/ChangeLog	9 Nov 2004 07:33:39 -0000
@@ -1,3 +1,18 @@
+2004-11-09  Not Zed  <NotZed Ximian com>
+
+	* providers/imap/camel-imap-folder.c (imap_get_message): before
+	short-circuiting the check for child content, check the child
+	content info is actually correct.
+
+2004-11-08  Not Zed  <NotZed Ximian com>
+
+	** See bug #69145.
+
+	* providers/imap/camel-imap-folder.c (get_message): remove spec
+	argument, always calculate it from the content-info.
+	(content_info_incomplete): recursively check the content-info for
+	completeness, not just one level.
+
 2004-10-27  Julio M. Merino Vidal <jmmv menta net>
 
 	* camel-operation.c (camel_operation_shutdown): fix the arguments
Index: camel/providers/imap/camel-imap-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-folder.c,v
retrieving revision 1.337
diff -u -p -r1.337 camel-imap-folder.c
--- camel/providers/imap/camel-imap-folder.c	16 Jul 2004 17:11:11 -0000	1.337
+++ camel/providers/imap/camel-imap-folder.c	9 Nov 2004 07:33:40 -0000
@@ -71,7 +71,7 @@
 #include "camel-file-utils.h"
 #include "camel-debug.h"
 
-#define d(x) x
+#define d(x) 
 
 /* set to -1 for infinite size (suggested max command-line length is
  * 1000 octets (see rfc2683), so we should keep the uid-set length to
@@ -1626,7 +1626,6 @@ imap_search_free (CamelFolder *folder, G
 
 static CamelMimeMessage *get_message (CamelImapFolder *imap_folder,
 				      const char *uid,
-				      const char *part_specifier,
 				      CamelMessageContentInfo *ci,
 				      CamelException *ex);
 
@@ -1842,7 +1841,7 @@ get_content (CamelImapFolder *imap_folde
 		
 		return (CamelDataWrapper *) body_mp;
 	} else if (camel_content_type_is (ci->type, "message", "rfc822")) {
-		content = (CamelDataWrapper *) get_message (imap_folder, uid, part_spec, ci->childs, ex);
+		content = (CamelDataWrapper *) get_message (imap_folder, uid, ci->childs, ex);
 		g_free (part_spec);
 		return content;
 	} else {
@@ -1864,25 +1863,27 @@ get_content (CamelImapFolder *imap_folde
 
 static CamelMimeMessage *
 get_message (CamelImapFolder *imap_folder, const char *uid,
-	     const char *part_spec, CamelMessageContentInfo *ci,
+	     CamelMessageContentInfo *ci,
 	     CamelException *ex)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (CAMEL_FOLDER (imap_folder)->parent_store);
 	CamelDataWrapper *content;
 	CamelMimeMessage *msg;
 	CamelStream *stream;
-	char *section_text;
+	char *section_text, *part_spec;
 	int ret;
-	
+
+	part_spec = content_info_get_part_spec(ci);
+	d(printf("get message '%s'\n", part_spec));
 	section_text = g_strdup_printf ("%s%s%s", part_spec, *part_spec ? "." : "",
 					store->server_level >= IMAP_LEVEL_IMAP4REV1 ? "HEADER" : "0");
+
 	stream = camel_imap_folder_fetch_data (imap_folder, uid, section_text, FALSE, ex);
 	g_free (section_text);
+	g_free(part_spec);
 	if (!stream)
 		return NULL;
 
-	d(printf("get message '%s'\n", part_spec));
-
 	msg = camel_mime_message_new ();
 	ret = camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream);
 	camel_object_unref (CAMEL_OBJECT (stream));
@@ -1950,12 +1951,15 @@ content_info_incomplete (CamelMessageCon
 	if (!ci->type)
 		return TRUE;
 	
-	if (camel_content_type_is (ci->type, "multipart", "*") && !ci->childs)
-		return TRUE;
-	
-	if (camel_content_type_is (ci->type, "message", "rfc822") && !ci->childs)
-		return TRUE;
-	
+	if (camel_content_type_is (ci->type, "multipart", "*")
+	    || camel_content_type_is (ci->type, "message", "rfc822")) {
+		if (!ci->childs)
+			return TRUE;
+		for (ci = ci->childs;ci;ci=ci->next)
+			if (content_info_incomplete(ci))
+				return TRUE;
+	}
+
 	return FALSE;
 }
 
@@ -1998,7 +2002,7 @@ imap_get_message (CamelFolder *folder, c
 		if (store->server_level < IMAP_LEVEL_IMAP4REV1
 		    || store->braindamaged
 		    || mi->size < IMAP_SMALL_BODY_SIZE
-		    || !mi->content->childs) {
+		    || (!content_info_incomplete(mi->content) && !mi->content->childs)) {
 			msg = get_message_simple (imap_folder, uid, NULL, ex);
 		} else {
 			if (content_info_incomplete (mi->content)) {
@@ -2058,7 +2062,7 @@ imap_get_message (CamelFolder *folder, c
 			if (content_info_incomplete (mi->content))
 				msg = get_message_simple (imap_folder, uid, NULL, ex);
 			else
-				msg = get_message (imap_folder, uid, "", mi->content, ex);
+				msg = get_message (imap_folder, uid, mi->content, ex);
 		}
 	} while (msg == NULL
 		 && retry < 2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]