From b30295b408b5a6cd7c7760cf13d6c50186c7fb48 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 17 Oct 2012 12:07:05 +0200 Subject: Bug #686278 - Prefer-plain can break parts list --- modules/prefer-plain/e-mail-parser-prefer-plain.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/modules/prefer-plain/e-mail-parser-prefer-plain.c b/modules/prefer-plain/e-mail-parser-prefer-plain.c index cd0b0bc3c1..47d571b3e6 100644 --- a/modules/prefer-plain/e-mail-parser-prefer-plain.c +++ b/modules/prefer-plain/e-mail-parser-prefer-plain.c @@ -182,8 +182,7 @@ empe_prefer_plain_parse (EMailParserExtension *extension, GSList *parts; CamelContentType *ct; gboolean has_calendar = FALSE; - GSList *plain_text_parts, *iter; - GSList *plain_text_placeholder = NULL; + GSList *plain_text_parts = NULL; emp_pp = (EMailParserPreferPlain *) extension; @@ -220,7 +219,6 @@ empe_prefer_plain_parse (EMailParserExtension *extension, } nparts = camel_multipart_get_number (mp); - plain_text_parts = NULL; for (i = 0; i < nparts; i++) { CamelMimePart *sp; @@ -251,13 +249,10 @@ empe_prefer_plain_parse (EMailParserExtension *extension, if (camel_content_type_is (ct, "text", "plain")) { - plain_text_parts = e_mail_parser_parse_part ( - parser, sp, part_id, cancellable); + sparts = e_mail_parser_parse_part ( + parser, sp, part_id, cancellable); - /* Placeholder - we will replace it by the actual text/plain - * parts later */ - plain_text_placeholder = g_slist_alloc (); - parts = g_slist_concat (parts, plain_text_placeholder); + plain_text_parts = g_slist_concat (plain_text_parts, sparts); continue; } @@ -325,14 +320,10 @@ empe_prefer_plain_parse (EMailParserExtension *extension, hide_parts (plain_text_parts); } - /* Replace the plain_text_placeholder by the actual plain_text_parts */ - for (iter = parts; iter; iter = iter->next) { - if (iter && iter->next == plain_text_placeholder) { - break; - } + if (plain_text_parts) { + /* plain_text parts should be always first */ + parts = g_slist_concat (plain_text_parts, parts); } - plain_text_parts = g_slist_concat (plain_text_parts, plain_text_placeholder); - parts = g_slist_concat (iter, plain_text_parts); g_string_truncate (part_id, partidlen); -- cgit v1.2.3