aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-09 05:57:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-09 05:57:19 +0800
commit514736f27efeac6d5ad42e055ebabb423d243fb2 (patch)
tree3cd008d9bec8fd031d5b6d5a6f8d3bfa2f4b26ec
parent0ac936cfe3fb6e1a8e97ec6187d2f174de2f2f9c (diff)
downloadgsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.tar
gsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.tar.gz
gsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.tar.bz2
gsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.tar.lz
gsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.tar.xz
gsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.tar.zst
gsoc2013-evolution-514736f27efeac6d5ad42e055ebabb423d243fb2.zip
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. */
-rw-r--r--em-format/e-mail-parser-message.c24
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 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);