aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2007-10-30 17:06:26 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-10-30 17:06:26 +0800
commit21ec67eb25834ee0b37d72bafd464cb8b395efe5 (patch)
treed9f791a536290bc4183725a0c7528726406be30c /plugins
parent69c8f40f0919bf60dc39ea5d0e905e446a619870 (diff)
downloadgsoc2013-evolution-21ec67eb25834ee0b37d72bafd464cb8b395efe5.tar.gz
gsoc2013-evolution-21ec67eb25834ee0b37d72bafd464cb8b395efe5.tar.zst
gsoc2013-evolution-21ec67eb25834ee0b37d72bafd464cb8b395efe5.zip
** Fix for bug #487922 (Sometimes evolution does not recognize
2007-10-30 Milan Crha <mcrha@redhat.com> ** Fix for bug #487922 (Sometimes evolution does not recognize attachments) * prefer-plain.c: (export_as_attachments): New helper function to export message parts as attachments. This will traverse whole hierarchy of message's parts in multipart message. * prefer-plain.c: (org_gnome_prefer_plain_multipart_alternative): Use this function to export other parts as attachments. svn path=/trunk/; revision=34452
Diffstat (limited to 'plugins')
-rw-r--r--plugins/prefer-plain/ChangeLog11
-rw-r--r--plugins/prefer-plain/prefer-plain.c54
2 files changed, 55 insertions, 10 deletions
diff --git a/plugins/prefer-plain/ChangeLog b/plugins/prefer-plain/ChangeLog
index b9d69d4a36..82cd184dc0 100644
--- a/plugins/prefer-plain/ChangeLog
+++ b/plugins/prefer-plain/ChangeLog
@@ -1,3 +1,14 @@
+2007-10-30 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #487922
+ (Sometimes evolution does not recognize attachments)
+
+ * prefer-plain.c: (export_as_attachments): New helper function to
+ export message parts as attachments. This will traverse whole
+ hierarchy of message's parts in multipart message.
+ * prefer-plain.c: (org_gnome_prefer_plain_multipart_alternative):
+ Use this function to export other parts as attachments.
+
2007-09-05 Sankar P <psankar@novell.com>
* prefer-plain.c: (e_plugin_lib_enable):
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index b21b69b53f..56d4bd3458 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -48,6 +48,49 @@ org_gnome_prefer_plain_text_html(void *ep, EMFormatHookTarget *t)
em_format_part_as(t->format, t->stream, t->part, NULL);
}
+static void
+export_as_attachments (CamelMultipart *mp, EMFormat *format, CamelStream *stream, CamelMimePart *except)
+{
+ int i, nparts, partidlen;
+ CamelMimePart *part;
+
+ if (!mp || !CAMEL_IS_MULTIPART (mp))
+ return;
+
+ partidlen = format->part_id->len;
+
+ nparts = camel_multipart_get_number(mp);
+ for (i = 0; i < nparts; i++) {
+ part = camel_multipart_get_part (mp, i);
+
+ if (part != except) {
+ CamelMultipart *multipart = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
+
+ if (CAMEL_IS_MULTIPART (multipart)) {
+ export_as_attachments (multipart, format, stream, except);
+ } else {
+ g_string_append_printf (format->part_id, ".alternative.%d", i);
+
+ if (camel_content_type_is (camel_mime_part_get_content_type (part), "text", "html")) {
+ /* always show HTML as attachments and not inline */
+ camel_mime_part_set_disposition (part, "attachment");
+
+ if (!camel_mime_part_get_filename (part)) {
+ char *str = g_strdup_printf ("%s.html", _("attachment"));
+ camel_mime_part_set_filename (part, str);
+ g_free (str);
+ }
+
+ em_format_part_as (format, stream, part, "application/octet-stream");
+ } else
+ em_format_part (format, stream, part);
+
+ g_string_truncate (format->part_id, partidlen);
+ }
+ }
+ }
+}
+
void
org_gnome_prefer_plain_multipart_alternative(void *ep, EMFormatHookTarget *t)
{
@@ -84,16 +127,7 @@ org_gnome_prefer_plain_multipart_alternative(void *ep, EMFormatHookTarget *t)
}
/* all other parts are attachments */
- for (i=0;i<nparts; i++) {
- part = camel_multipart_get_part(mp, i);
- if (part != display_part) {
- g_string_append_printf(t->format->part_id, ".alternative.%d", i);
-
- em_format_part_as(t->format, t->stream, t->part, NULL);
-
- g_string_truncate(t->format->part_id, partidlen);
- }
- }
+ export_as_attachments (mp, t->format, t->stream, display_part);
g_string_truncate(t->format->part_id, partidlen);
}
bn?h=mate-1.18&id=fb1ceaa27cd13f77b2b4fd02f6bb6a49551ba055'>Update to KDE 3.5.2lofi2006-03-312-4/+14 * Update to KDE 3.5.1.lofi2006-02-012-3/+9 * Update to KDE 3.5.0lofi2006-01-092-17/+4 * Update to KDE 3.4.3 / KOffice 1.4.2lofi2005-11-052-3/+3 * Update to KDE 3.4.2 / KOffice 1.4.1lofi2005-08-011-2/+2 * Update to KDE 3.4.1lofi2005-06-261-2/+2 * Update to KDE 3.4lofi2005-03-212-8/+2 * Fix kde3-i18n ports.lofi2004-12-161-2/+2 * Update to KDE 3.3.2lofi2004-12-143-3/+10 * Update to KDE 3.3.1lofi2004-11-082-2/+19 * Update to KDE 3.3lofi2004-08-313-6/+74 * Update to version 3.2.3lofi2004-06-102-2/+45 * Update to KDE 3.2.2lofi2004-04-202-6/+28 * Update to KDE 3.2.1 / QT 3.3.1lofi2004-03-101-2/+0