From 5ce8bf667d7151dee9a93c8421730c28877be9a5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 13 Sep 2012 08:37:38 +0200 Subject: [text/plain parser] Use original part when nothing found inline This way the view corresponds to the original part properties, not those stripped by the inline filter. Also initialize EMailInlineFilter::filename on creation of the structure, thus the value is actually used on the subparts, if needed. --- em-format/e-mail-parser-text-plain.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'em-format/e-mail-parser-text-plain.c') diff --git a/em-format/e-mail-parser-text-plain.c b/em-format/e-mail-parser-text-plain.c index bc527e4fe4..3503be5979 100644 --- a/em-format/e-mail-parser-text-plain.c +++ b/em-format/e-mail-parser-text-plain.c @@ -186,7 +186,11 @@ empe_text_plain_parse (EMailParserExtension *extension, null = camel_stream_null_new (); filtered_stream = camel_stream_filter_new (null); g_object_unref (null); - inline_filter = e_mail_inline_filter_new (camel_mime_part_get_encoding (part), type); + inline_filter = e_mail_inline_filter_new ( + camel_mime_part_get_encoding (part), + type, + camel_mime_part_get_filename (part)); + camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (inline_filter)); @@ -195,6 +199,15 @@ empe_text_plain_parse (EMailParserExtension *extension, camel_stream_close ((CamelStream *) filtered_stream, cancellable, NULL); g_object_unref (filtered_stream); + if (!e_mail_inline_filter_found_any (inline_filter)) { + g_object_unref (inline_filter); + camel_content_type_unref (type); + + return process_part (parser, part_id, 0, + part, e_mail_part_is_attachment (part), + cancellable); + } + mp = e_mail_inline_filter_get_multipart (inline_filter); if (charset_added) { -- cgit v1.2.3