[evolution] Bug 726203 - Incorrect part ID used for multipart/related attachments



commit b16e1b62a205cdf7dc1adb9a7d998cf03e29c881
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 9 14:30:44 2015 +0100

    Bug 726203 - Incorrect part ID used for multipart/related attachments

 e-util/e-attachment-button.c                |    2 +-
 em-format/e-mail-parser-multipart-related.c |   14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/e-util/e-attachment-button.c b/e-util/e-attachment-button.c
index eabebf8..25017d7 100644
--- a/e-util/e-attachment-button.c
+++ b/e-util/e-attachment-button.c
@@ -681,7 +681,7 @@ e_attachment_button_init (EAttachmentButton *button)
 }
 
 GtkWidget *
-e_attachment_button_new ()
+e_attachment_button_new (void)
 {
        return g_object_new (
                E_TYPE_ATTACHMENT_BUTTON, NULL);
diff --git a/em-format/e-mail-parser-multipart-related.c b/em-format/e-mail-parser-multipart-related.c
index c3bdab0..6e9956a 100644
--- a/em-format/e-mail-parser-multipart-related.c
+++ b/em-format/e-mail-parser-multipart-related.c
@@ -124,6 +124,7 @@ empe_mp_related_parse (EMailParserExtension *extension,
        for (i = 0; i < nparts; i++) {
                GQueue work_queue = G_QUEUE_INIT;
                GList *head, *link;
+               gint subpart_index = 0;
 
                body_part = camel_multipart_get_part (mp, i);
 
@@ -136,11 +137,9 @@ empe_mp_related_parse (EMailParserExtension *extension,
                        parser, body_part, part_id,
                        cancellable, &work_queue);
 
-               g_string_truncate (part_id, partidlen);
-
                head = g_queue_peek_head_link (&work_queue);
 
-               for (link = head; link != NULL; link = g_list_next (link)) {
+               for (link = head; link != NULL; link = g_list_next (link), subpart_index++) {
                        EMailPart *mail_part = link->data;
                        const gchar *cid;
 
@@ -152,12 +151,21 @@ empe_mp_related_parse (EMailParserExtension *extension,
                        else if (cid && E_IS_MAIL_PART_IMAGE (mail_part) &&
                                 e_mail_part_get_is_attachment (mail_part) &&
                                 mail_part->is_hidden) {
+                               gint sub_partidlen;
+
                                mail_part->is_hidden = FALSE;
 
+                               sub_partidlen = part_id->len;
+                               g_string_append_printf (part_id, ".subpart.%d", subpart_index);
+
                                e_mail_parser_wrap_as_attachment (parser, body_part, part_id, &work_queue);
+
+                               g_string_truncate (part_id, sub_partidlen);
                        }
                }
 
+               g_string_truncate (part_id, partidlen);
+
                e_queue_transfer (&work_queue, out_mail_parts);
        }
 


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