aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-10-17 18:07:05 +0800
committerMilan Crha <mcrha@redhat.com>2012-10-17 18:07:05 +0800
commitb30295b408b5a6cd7c7760cf13d6c50186c7fb48 (patch)
tree64731c683d47ddcbc1d27132ec46180f367ccc9c
parentd84ba383ac994cbebd3976c9d747e04e79e953ff (diff)
downloadgsoc2013-evolution-b30295b408b5a6cd7c7760cf13d6c50186c7fb48.tar.gz
gsoc2013-evolution-b30295b408b5a6cd7c7760cf13d6c50186c7fb48.tar.zst
gsoc2013-evolution-b30295b408b5a6cd7c7760cf13d6c50186c7fb48.zip
Bug #686278 - Prefer-plain can break parts list
-rw-r--r--modules/prefer-plain/e-mail-parser-prefer-plain.c23
1 files 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);