diff options
author | Milan Crha <mcrha@redhat.com> | 2013-02-20 19:01:20 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-02-20 19:01:20 +0800 |
commit | ba241f88ef9b58f7a714d1c068734d5b74a1f056 (patch) | |
tree | 1b86d0e13ea98642962e7a4de5b1ede730af77c3 /e-util | |
parent | 80b93e39ac63a1adb76610e0f84c5273f675e603 (diff) | |
download | gsoc2013-evolution-ba241f88ef9b58f7a714d1c068734d5b74a1f056.tar.gz gsoc2013-evolution-ba241f88ef9b58f7a714d1c068734d5b74a1f056.tar.zst gsoc2013-evolution-ba241f88ef9b58f7a714d1c068734d5b74a1f056.zip |
EAttachment: Use Subject as fallback filename for message attachments
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-attachment.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/e-util/e-attachment.c b/e-util/e-attachment.c index a460890246..495c805f16 100644 --- a/e-util/e-attachment.c +++ b/e-util/e-attachment.c @@ -1839,6 +1839,27 @@ attachment_load_from_mime_part_thread (GSimpleAsyncResult *simple, if (string == NULL) { /* Translators: Default attachment filename. */ string = _("attachment.dat"); + + if (camel_content_type_is (content_type, "message", "rfc822")) { + CamelMimeMessage *msg = NULL; + const gchar *subject = NULL; + + if (CAMEL_IS_MIME_MESSAGE (mime_part)) { + msg = CAMEL_MIME_MESSAGE (mime_part); + } else { + CamelDataWrapper *content; + + content = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); + if (CAMEL_IS_MIME_MESSAGE (content)) + msg = CAMEL_MIME_MESSAGE (content); + } + + if (msg) + subject = camel_mime_message_get_subject (msg); + + if (subject && *subject) + string = subject; + } } else { decoded_string = camel_header_decode_string (string, "UTF-8"); if (decoded_string && *decoded_string && !g_str_equal (decoded_string, string)) { |