From 514736f27efeac6d5ad42e055ebabb423d243fb2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 8 Jul 2013 17:57:19 -0400 Subject: EMailParserMessage: Better handle message bodies as attachments. Simo Sorce sent me an interesting case where the MIME type of the message itself was image/gif, but the image was not being shown. If the EMailPart representing the message body is marked as an attachment, wrap it as such so it gets added to the attachment bar but also set the "force_inline" flag since it doesn't make sense to collapse the message body if we can render it. */ --- em-format/e-mail-parser-message.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'em-format') diff --git a/em-format/e-mail-parser-message.c b/em-format/e-mail-parser-message.c index ad91e426e6..609663201c 100644 --- a/em-format/e-mail-parser-message.c +++ b/em-format/e-mail-parser-message.c @@ -52,7 +52,9 @@ empe_message_parse (EMailParserExtension *extension, GCancellable *cancellable, GQueue *out_mail_parts) { + GQueue work_queue = G_QUEUE_INIT; CamelContentType *ct; + EMailPart *mail_part; gchar *mime_type; /* Headers */ @@ -85,9 +87,29 @@ empe_message_parse (EMailParserExtension *extension, } /* Actual message body */ + e_mail_parser_parse_part_as ( parser, part, part_id, mime_type, - cancellable, out_mail_parts); + cancellable, &work_queue); + + /* If the EMailPart representing the message body is marked as an + * attachment, wrap it as such so it gets added to the attachment + * bar but also set the "force_inline" flag since it doesn't make + * sense to collapse the message body if we can render it. */ + mail_part = g_queue_peek_head (&work_queue); + if (mail_part != NULL) { + if (e_mail_part_get_is_attachment (mail_part)) { + e_mail_parser_wrap_as_attachment ( + parser, part, part_id, &work_queue); + + mail_part = g_queue_peek_head (&work_queue); + + if (mail_part != NULL) + mail_part->force_inline = TRUE; + } + } + + e_queue_transfer (&work_queue, out_mail_parts); g_free (mime_type); -- cgit v1.2.3