diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-08 23:12:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-08 23:53:02 +0800 |
commit | 35582bf4e29cc4aadf779d76096ef6dd47a7be1a (patch) | |
tree | ac63543600f9790153c30c4912f782c8d472a92d | |
parent | 5cf06f855f54cd81f0c96b6ea6474ba9fc5bb762 (diff) | |
download | gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.tar gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.tar.gz gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.tar.bz2 gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.tar.lz gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.tar.xz gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.tar.zst gsoc2013-evolution-35582bf4e29cc4aadf779d76096ef6dd47a7be1a.zip |
Bug 701669 - Bad assumption in prefer-plain module
For messages with a base MIME type of multipart/alternative, we were
hiding text/plain subparts based on the number of alternate subparts.
This assumption of course broke on a message with the following body
structure and a Plain Text Mode preference of "Show HTML if present":
multipart/alternative
text/plain
text/plain
Instead, note when we've actually seen a text/html subpart and use that
to decide whether to hide the text/plain parts.
-rw-r--r-- | modules/prefer-plain/e-mail-parser-prefer-plain.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/prefer-plain/e-mail-parser-prefer-plain.c b/modules/prefer-plain/e-mail-parser-prefer-plain.c index 09fe450b87..6e64ab6e0f 100644 --- a/modules/prefer-plain/e-mail-parser-prefer-plain.c +++ b/modules/prefer-plain/e-mail-parser-prefer-plain.c @@ -186,6 +186,7 @@ empe_prefer_plain_parse (EMailParserExtension *extension, gint i, nparts, partidlen; CamelContentType *ct; gboolean has_calendar = FALSE; + gboolean has_html = FALSE; gboolean prefer_html; GQueue plain_text_parts = G_QUEUE_INIT; GQueue work_queue = G_QUEUE_INIT; @@ -248,6 +249,8 @@ empe_prefer_plain_parse (EMailParserExtension *extension, cancellable, &work_queue); } + has_html = TRUE; + } else if (camel_content_type_is (ct, "text", "plain")) { e_mail_parser_parse_part ( parser, sp, part_id, @@ -300,6 +303,8 @@ empe_prefer_plain_parse (EMailParserExtension *extension, e_queue_transfer (&inner_queue, &work_queue); + has_html |= multipart_has_html; + /* Parse everything else as an attachment */ } else { GQueue inner_queue = G_QUEUE_INIT; @@ -315,10 +320,10 @@ empe_prefer_plain_parse (EMailParserExtension *extension, } /* Don't hide the plain text if there's nothing else to display */ - if (has_calendar || (nparts > 1 && emp_pp->mode == PREFER_HTML)) + if (has_calendar || (has_html && prefer_html)) hide_parts (&plain_text_parts); - if (!g_queue_is_empty (&plain_text_parts) && !g_queue_is_empty (&work_queue) && nparts > 1) { + if (!g_queue_is_empty (&plain_text_parts) && !g_queue_is_empty (&work_queue) && has_html) { /* a text/html part is hidden, but not marked as attachment, * thus do that now, when there exists a text/plain part */ GList *qiter; |