[evolution] EMailParserMessage: Better handle message bodies as attachments.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EMailParserMessage: Better handle message bodies as attachments.
- Date: Mon, 8 Jul 2013 22:00:08 +0000 (UTC)
commit 514736f27efeac6d5ad42e055ebabb423d243fb2
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Jul 8 17:57:19 2013 -0400
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 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/em-format/e-mail-parser-message.c b/em-format/e-mail-parser-message.c
index ad91e42..6096632 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]