aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/prefer-plain/ChangeLog7
-rw-r--r--plugins/prefer-plain/prefer-plain.c21
2 files changed, 27 insertions, 1 deletions
diff --git a/plugins/prefer-plain/ChangeLog b/plugins/prefer-plain/ChangeLog
index 1ac6c425a2..6780f577d1 100644
--- a/plugins/prefer-plain/ChangeLog
+++ b/plugins/prefer-plain/ChangeLog
@@ -1,3 +1,10 @@
+2008-04-17 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #451976
+
+ * prefer-plain.c: (org_gnome_prefer_plain_multipart_alternative): Try
+ to find text/html part in multipart/alternative when in normal mode.
+
2007-10-26 Kjartan Maraas <kmaraas@gnome.org>
* prefer-plain.c: (e_plugin_lib_enable):
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index 4846486053..0c5d57b54e 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -99,7 +99,26 @@ org_gnome_prefer_plain_multipart_alternative(void *ep, EMFormatHookTarget *t)
int i, nparts, partidlen, displayid = 0;
if (epp_mode == EPP_NORMAL) {
- t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old);
+ /* Try to find text/html part even when not as last and force to show it.
+ Old handler will show the last part of multipart/alternate, but if we
+ can offer HTML, then offer it, regardless of position in multipart. */
+ nparts = camel_multipart_get_number (mp);
+ for (i = 0; i < nparts; i++) {
+ part = camel_multipart_get_part (mp, i);
+ if (part && camel_content_type_is (camel_mime_part_get_content_type (part), "text", "html")) {
+ displayid = i;
+ display_part = part;
+ break;
+ }
+ }
+
+ if (display_part) {
+ g_string_append_printf (t->format->part_id, ".alternative.%d", displayid);
+ em_format_part_as (t->format, t->stream, display_part, "text/html");
+ g_string_truncate (t->format->part_id, partidlen);
+ } else {
+ t->item->handler.old->handler (t->format, t->stream, t->part, t->item->handler.old);
+ }
return;
} else if (!CAMEL_IS_MULTIPART(mp)) {
em_format_format_source(t->format, t->stream, t->part);