[evolution/gnome-3-8] Bug 701669 - Bad assumption in prefer-plain module
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-8] Bug 701669 - Bad assumption in prefer-plain module
- Date: Sat, 8 Jun 2013 16:00:44 +0000 (UTC)
commit 27c65132db78da470d2f4a1dc35e74edf6fd7099
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Jun 8 11:12:46 2013 -0400
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.
(cherry picked from commit 35582bf4e29cc4aadf779d76096ef6dd47a7be1a)
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 75a3be6..3902555 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]