From 0a6672a1bd2354198f8d37a8f4a7ff26d4f6af78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Tue, 28 Aug 2012 14:09:25 +0200 Subject: Add support for application/ics to ITIP formatter --- modules/itip-formatter/e-mail-formatter-itip.c | 4 +++- modules/itip-formatter/e-mail-parser-itip.c | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c index 3b761276a1..ca6b2f64cd 100644 --- a/modules/itip-formatter/e-mail-formatter-itip.c +++ b/modules/itip-formatter/e-mail-formatter-itip.c @@ -58,7 +58,9 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_FORMATTER_EXTENSION, e_mail_formatter_formatter_extension_interface_init)); -static const gchar * formatter_mime_types[] = { "text/calendar" , NULL }; +static const gchar * formatter_mime_types[] = { "text/calendar", + "application/ics", + NULL }; static gboolean emfe_itip_format (EMailFormatterExtension *extension, diff --git a/modules/itip-formatter/e-mail-parser-itip.c b/modules/itip-formatter/e-mail-parser-itip.c index 6c740ada75..56bbd53da1 100644 --- a/modules/itip-formatter/e-mail-parser-itip.c +++ b/modules/itip-formatter/e-mail-parser-itip.c @@ -68,7 +68,9 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_PARSER_EXTENSION, e_mail_parser_parser_extension_interface_init)); -static const gchar * parser_mime_types[] = { "text/calendar", NULL }; +static const gchar * parser_mime_types[] = { "text/calendar", + "application/ics", + NULL }; static void mail_part_itip_free (EMailPart *mail_part) @@ -192,6 +194,8 @@ empe_itip_parse (EMailParserExtension *extension, CamelStream *stream; GByteArray *byte_array; gint len; + const CamelContentDisposition *disposition; + GSList *parts; len = part_id->len; g_string_append_printf (part_id, ".itip"); @@ -204,6 +208,7 @@ empe_itip_parse (EMailParserExtension *extension, (GFreeFunc) mail_part_itip_free); itip_part->parent.mime_type = g_strdup ("text/calendar"); itip_part->parent.bind_func = bind_itip_view; + itip_part->parent.force_collapse = TRUE; itip_part->delete_message = g_settings_get_boolean (settings, CONF_KEY_DELETE); itip_part->has_organizer = FALSE; itip_part->no_reply_wanted = FALSE; @@ -228,9 +233,19 @@ empe_itip_parse (EMailParserExtension *extension, (gchar *) byte_array->data, byte_array->len); g_object_unref (stream); + + parts = g_slist_append (NULL, itip_part); + + disposition = camel_mime_part_get_content_disposition (part); + if (disposition && + (g_strcmp0 (disposition->disposition, "attachment") == 0)) { + parts = e_mail_parser_wrap_as_attachment ( + parser, part, parts, part_id, cancellable); + } + g_string_truncate (part_id, len); - return g_slist_append (NULL, itip_part); + return parts; } static guint32 -- cgit v1.2.3