aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--em-format/e-mail-inline-filter.c7
-rw-r--r--em-format/e-mail-inline-filter.h3
-rw-r--r--em-format/e-mail-parser-text-plain.c15
3 files changed, 22 insertions, 3 deletions
diff --git a/em-format/e-mail-inline-filter.c b/em-format/e-mail-inline-filter.c
index 0c2e6b835e..242ac5959a 100644
--- a/em-format/e-mail-inline-filter.c
+++ b/em-format/e-mail-inline-filter.c
@@ -415,6 +415,7 @@ e_mail_inline_filter_init (EMailInlineFilter *emif)
* raw data being processed.
* @base_type: The base content-type of the raw data, should always be
* text/plain.
+ * @filename: Filename of the part, or NULL
*
* Create a filter which will scan a (text) stream for
* embedded parts. You can then retrieve the contents
@@ -424,7 +425,8 @@ e_mail_inline_filter_init (EMailInlineFilter *emif)
**/
EMailInlineFilter *
e_mail_inline_filter_new (CamelTransferEncoding base_encoding,
- CamelContentType *base_type)
+ CamelContentType *base_type,
+ const gchar *filename)
{
EMailInlineFilter *emif;
@@ -435,6 +437,9 @@ e_mail_inline_filter_new (CamelTransferEncoding base_encoding,
camel_content_type_ref (emif->base_type);
}
+ if (filename && *filename)
+ emif->filename = g_strdup (filename);
+
return emif;
}
diff --git a/em-format/e-mail-inline-filter.h b/em-format/e-mail-inline-filter.h
index ff8248c681..979ac46a12 100644
--- a/em-format/e-mail-inline-filter.h
+++ b/em-format/e-mail-inline-filter.h
@@ -72,7 +72,8 @@ struct _EMailInlineFilterClass {
GType e_mail_inline_filter_get_type (void);
EMailInlineFilter *
e_mail_inline_filter_new (CamelTransferEncoding base_encoding,
- CamelContentType *type);
+ CamelContentType *type,
+ const gchar *filename);
CamelMultipart *e_mail_inline_filter_get_multipart
(EMailInlineFilter *emif);
gboolean e_mail_inline_filter_found_any (EMailInlineFilter *emif);
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) {