aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-10-18 19:15:39 +0800
committerMilan Crha <mcrha@redhat.com>2010-10-18 19:15:39 +0800
commitf7f4014e220f9ea4ca635d6fbc852f179d5c6656 (patch)
tree7be19f2774f181361e5759e4bdf1109929e2ba48
parent51dc6864b87ad32df4df6c840251c6b4f4c85f39 (diff)
downloadgsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.tar
gsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.tar.gz
gsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.tar.bz2
gsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.tar.lz
gsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.tar.xz
gsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.tar.zst
gsoc2013-evolution-f7f4014e220f9ea4ca635d6fbc852f179d5c6656.zip
Bug #630518 - Hides calendar parts from multipart/alternative
-rw-r--r--em-format/em-format.c2
-rw-r--r--plugins/prefer-plain/prefer-plain.c19
2 files changed, 17 insertions, 4 deletions
diff --git a/em-format/em-format.c b/em-format/em-format.c
index dc20ac596d..1d0c60161a 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 9fce56d65c..21c5a6b625 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);
}