diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-08-17 20:43:12 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-08-17 20:43:12 +0800 |
commit | fb591577393c130df48cb33af455bf44d8875897 (patch) | |
tree | 90216e047f9703c5c43a97a6facd83aff276f4bd | |
parent | 74c1bf97148725d0e8097d9a22b76f228cb32be9 (diff) | |
download | gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.tar gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.tar.gz gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.tar.bz2 gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.tar.lz gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.tar.xz gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.tar.zst gsoc2013-evolution-fb591577393c130df48cb33af455bf44d8875897.zip |
Bug #682019 - Always display text/plain when there's nothing else in multipart/alternative
-rw-r--r-- | modules/prefer-plain/e-mail-parser-prefer-plain.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/modules/prefer-plain/e-mail-parser-prefer-plain.c b/modules/prefer-plain/e-mail-parser-prefer-plain.c index 714e4e462e..b5f8db2365 100644 --- a/modules/prefer-plain/e-mail-parser-prefer-plain.c +++ b/modules/prefer-plain/e-mail-parser-prefer-plain.c @@ -181,6 +181,8 @@ empe_prefer_plain_parse (EMailParserExtension *extension, gint i, nparts, partidlen; GSList *parts; CamelContentType *ct; + gboolean has_html; + GSList *plain_text_parts; emp_pp = (EMailParserPreferPlain *) extension; @@ -222,6 +224,7 @@ empe_prefer_plain_parse (EMailParserExtension *extension, } nparts = camel_multipart_get_number (mp); + has_html = FALSE; for (i = 0; i < nparts; i++) { CamelMimePart *sp; @@ -243,27 +246,21 @@ empe_prefer_plain_parse (EMailParserExtension *extension, } else { sparts = e_mail_parser_parse_part ( parser, sp, part_id, cancellable); - hide_parts (sparts); } } else { sparts = e_mail_parser_parse_part ( parser, sp, part_id, cancellable); } + has_html = TRUE; parts = g_slist_concat (parts, sparts); continue; } if (camel_content_type_is (ct, "text", "plain")) { - sparts = e_mail_parser_parse_part ( - parser, sp, part_id, cancellable); - - if (emp_pp->mode == PREFER_HTML) { - hide_parts (sparts); - } - - parts = g_slist_concat (parts, sparts); + plain_text_parts = e_mail_parser_parse_part ( + parser, sp, part_id, cancellable); continue; } @@ -325,6 +322,14 @@ empe_prefer_plain_parse (EMailParserExtension *extension, cancellable)); } + /* Don't hide the plain text if there's nothing else to display */ + if ((emp_pp->mode == PREFER_HTML) && has_html) { + hide_parts (plain_text_parts); + } + + parts = g_slist_concat (parts, plain_text_parts); + + g_string_truncate (part_id, partidlen); return parts; |