[evolution] Bug #630518 - Hides calendar parts from multipart/alternative
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #630518 - Hides calendar parts from multipart/alternative
- Date: Mon, 18 Oct 2010 11:16:28 +0000 (UTC)
commit f7f4014e220f9ea4ca635d6fbc852f179d5c6656
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 18 13:15:39 2010 +0200
Bug #630518 - Hides calendar parts from multipart/alternative
em-format/em-format.c | 2 ++
plugins/prefer-plain/prefer-plain.c | 19 +++++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index dc20ac5..1d0c601 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1136,6 +1136,8 @@ em_format_is_attachment (EMFormat *emf,
|| camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-signed")
|| camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-encrypted")
|| camel_content_type_is(dw->mime_type, "x-evolution", "evolution-rss-feed")
+ || camel_content_type_is(dw->mime_type, "text", "calendar")
+ || camel_content_type_is(dw->mime_type, "text", "x-calendar")
|| (camel_content_type_is (dw->mime_type, "text", "*")
&& camel_mime_part_get_filename (part) == NULL));
}
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index 9fce56d..21c5a6b 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -121,8 +121,8 @@ void
org_gnome_prefer_plain_multipart_alternative (gpointer ep, EMFormatHookTarget *t)
{
CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content ((CamelMedium *)t->part);
- CamelMimePart *part, *display_part = NULL;
- gint i, nparts, partidlen, displayid = 0;
+ CamelMimePart *part, *display_part = NULL, *calendar_part = NULL;
+ gint i, nparts, partidlen, displayid = 0, calendarid = 0;
/* FIXME: this part-id stuff is poking private data, needs api */
partidlen = t->format->part_id->len;
@@ -181,11 +181,20 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep, EMFormatHookTarget *t
nparts = camel_multipart_get_number (mp);
for (i=0; i<nparts; i++) {
+ CamelContentType *ct;
+
part = camel_multipart_get_part (mp, i);
- if (part && camel_content_type_is(camel_mime_part_get_content_type(part), "text", "plain")) {
+
+ if (!part)
+ continue;
+
+ ct = camel_mime_part_get_content_type (part);
+ if (!display_part && camel_content_type_is (ct, "text", "plain")) {
displayid = i;
display_part = part;
- break;
+ } else if (!calendar_part && (camel_content_type_is (ct, "text", "calendar") || camel_content_type_is (ct, "text", "x-calendar"))) {
+ calendarid = i;
+ calendar_part = part;
}
}
@@ -202,6 +211,8 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep, EMFormatHookTarget *t
/* all other parts are attachments */
if (epp_show_suppressed)
export_as_attachments (mp, t->format, t->stream, display_part);
+ else if (calendar_part)
+ make_part_attachment (t->format, t->stream, calendar_part, calendarid);
g_string_truncate (t->format->part_id, partidlen);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]