From ec1e729d9455dd07ed09b3e6a5cfb4cfe85a27f1 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 17 Mar 2004 21:17:14 +0000 Subject: Checking that mi->content->type != NULL is no longer good enough to tell 2004-03-17 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_get_message): Checking that mi->content->type != NULL is no longer good enough to tell if a ContentInfo is complete (ie. contains the parsed BODY response). We need to check that th ContentInfo has children if the part is a multipart of message/rfc822 part. Apparently Zucchi didn't test his camel-folder-summary changes using IMAP. svn path=/trunk/; revision=25105 --- camel/ChangeLog | 9 +++++++++ camel/providers/imap/camel-imap-folder.c | 25 +++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 49df310c27..af600c0557 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2004-03-17 Jeffrey Stedfast + + * providers/imap/camel-imap-folder.c (imap_get_message): Checking + that mi->content->type != NULL is no longer good enough to tell if + a ContentInfo is complete (ie. contains the parsed BODY + response). We need to check that th ContentInfo has children if + the part is a multipart of message/rfc822 part. Apparently Zucchi + didn't test his camel-folder-summary changes using IMAP. + 2004-03-17 Radek Doulik * camel-folder-summary.h: use 1<<30 for CAMEL_MESSAGE_JUNK_LEARN, diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 0835534ea1..7db367a8cb 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -71,7 +71,7 @@ #include "camel-file-utils.h" -#define d(x) +#define d(x) x /* set to -1 for infinite size */ #define UID_SET_LIMIT (4096) @@ -1746,7 +1746,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid, part_spec = content_info_get_part_spec (ci); - d(printf("get content '%s' '%s'\n", part_spec, camel_content_type_format(ci->type))); + d(printf("get content '%s' '%s' (frommsg = %d)\n", part_spec, camel_content_type_format(ci->type), frommsg)); /* There are three cases: multipart/signed, multipart, message/rfc822, and "other" */ if (camel_content_type_is (ci->type, "multipart", "signed")) { @@ -1801,6 +1801,8 @@ get_content (CamelImapFolder *imap_folder, const char *uid, child_spec[speclen++] = '.'; g_free (part_spec); + fprintf (stderr, "here we are, trying to fetch a multipart/*: ci->childs = %p; ci->next = %p\n", ci->childs, ci->next); + ci = ci->childs; num = 1; while (ci) { @@ -1933,6 +1935,21 @@ get_message_simple (CamelImapFolder *imap_folder, const char *uid, return msg; } +static gboolean +content_info_incomplete (CamelMessageContentInfo *ci) +{ + 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; + + return FALSE; +} + static CamelMimeMessage * imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex) { @@ -1967,7 +1984,7 @@ imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex) * mi->content because camel_folder_summary_info_new always creates * an empty content struct.) */ - if (!mi->content->type) { + if (content_info_incomplete (mi->content)) { CamelImapResponse *response; GData *fetch_data = NULL; char *body, *found_uid; @@ -2007,7 +2024,7 @@ imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex) camel_imap_response_free (store, response); - if (!mi->content->type) { + if (content_info_incomplete (mi->content)) { /* FETCH returned OK, but we didn't parse a BODY * response. Courier will return invalid BODY * responses for invalidly MIMEd messages, so -- cgit v1.2.3