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




Ok, i don't like this patch, because all its doing is falling back to downloading the whole part and thus throwing away almost all the code we have there for doing 4rev1 stuff in the first place.  Its just hiding some of the many bugs in that code.

Anyway i've attached a fix for those bugs (or enough to get a test case to work), although i haven't tested much beyond this specific case.

What it was doing was fetching the same headers twice, that is, fetching "HEADER" when it was supposed to be fetching "1.HEADER" for the embedded message.  And then it ended up setting up a "1" part for the attachment content rather than "1.TEXT", and thus it shows the whole message as text, including the headers.

Lastly, the contentinfo_incomplete thing was failing since we had a partially setup mi->content which had empty children, but not no children, so it was considering it complete.

Michael

PS i'm not sure it was worth all the effort, but, well its done now.

On Fri, 2004-11-05 at 12:51 -0500, Jeffrey Stedfast wrote:
http://bugzilla.ximian.com/show_bug.cgi?id=69145

this is a bug that's been sitting in my inbox for a week or 2 now that
I've been wrestling with fixing when I get bored hacking on imap4.
;
--
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	8 Nov 2004 02:59:49 -0000
@@ -1,3 +1,12 @@
+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	8 Nov 2004 02:59:50 -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;
 }
 
@@ -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]