From 34d05a6f6f0faefb5dffa2970cc6624ef886beb0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 24 May 2002 22:43:31 +0000 Subject: Helps if we allocate enough space here. Also, start smoking the same 2002-05-24 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (content_info_get_part_spec): Helps if we allocate enough space here. Also, start smoking the same purple flavoured IMAP crack when counting parts (parts don't count if their parent part is a message/* part with a parent part). Fixes bug #25260. svn path=/trunk/; revision=17014 --- camel/providers/imap/camel-imap-folder.c | 14 +++++++++++--- camel/providers/imap/camel-imap-store.c | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'camel/providers/imap') diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index f8d3a59594..0b9f785d21 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -1526,6 +1526,12 @@ content_info_get_part_spec (CamelMessageContentInfo *ci) while (node->parent) { CamelMessageContentInfo *child; + /* FIXME: is this only supposed to apply if 'node' is a multipart? */ + if (node->parent->parent && header_content_type_is (node->parent->type, "message", "*")) { + node = node->parent; + continue; + } + child = node->parent->childs; for (part = 1; child; part++) { if (child == node) @@ -1536,7 +1542,7 @@ content_info_get_part_spec (CamelMessageContentInfo *ci) part_spec_push (&stack, part); - len++; + len += 2; while ((part = part / 10)) len++; @@ -1581,7 +1587,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid, camel_multipart_set_boundary (body_mp, NULL); speclen = strlen (part_spec); - child_spec = g_malloc (speclen + 16); + child_spec = g_malloc (speclen + 17); /* dot + 10 + dot + MIME + nul */ memcpy (child_spec, part_spec, speclen); if (speclen > 0) child_spec[speclen++] = '.'; @@ -1607,9 +1613,10 @@ get_content (CamelImapFolder *imap_folder, const char *uid, content = get_content (imap_folder, uid, part, ci, ex); } + if (!stream || !content) { - g_free (child_spec); camel_object_unref (CAMEL_OBJECT (body_mp)); + g_free (child_spec); return NULL; } @@ -1620,6 +1627,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid, ci = ci->next; } + g_free (child_spec); return (CamelDataWrapper *)body_mp; diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index b97f8c0f1a..f45531145d 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -2271,7 +2271,7 @@ camel_imap_store_readline (CamelImapStore *store, char **dest, CamelException *e #if d(!)0 if (camel_verbose_debug) { fprintf (stderr, "received: "); - fwrite (*dest, 1, nread, stderr); + fwrite (ba->data, 1, ba->len, stderr); } #endif -- cgit