aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-05-27 20:38:43 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-05-27 20:38:43 +0800
commitb38ca91b470caafbbbd10bc6583e9a1012532976 (patch)
tree55efeff64a80358a8897273ffba42bdf91e15da5
parentc498df626b4b770a0bc6b35066af1a9bcfbeb2b9 (diff)
downloadgsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.tar
gsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.tar.gz
gsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.tar.bz2
gsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.tar.lz
gsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.tar.xz
gsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.tar.zst
gsoc2013-evolution-b38ca91b470caafbbbd10bc6583e9a1012532976.zip
** Fix for bug #532384
2008-05-27 Milan Crha <mcrha@redhat.com> ** Fix for bug #532384 * prefer-plain.c: (org_gnome_prefer_plain_multipart_alternative): Choose the text/html part in normal mode only if the alrenative multipart contains also a text/plain part. svn path=/branches/gnome-2-22/; revision=35555
-rw-r--r--plugins/prefer-plain/ChangeLog8
-rw-r--r--plugins/prefer-plain/prefer-plain.c29
2 files changed, 33 insertions, 4 deletions
diff --git a/plugins/prefer-plain/ChangeLog b/plugins/prefer-plain/ChangeLog
index 6780f577d1..274dde355c 100644
--- a/plugins/prefer-plain/ChangeLog
+++ b/plugins/prefer-plain/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-27 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #532384
+
+ * prefer-plain.c: (org_gnome_prefer_plain_multipart_alternative):
+ Choose the text/html part in normal mode only if the alrenative
+ multipart contains also a text/plain part.
+
2008-04-17 Milan Crha <mcrha@redhat.com>
** Fix for bug #451976
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index 0c5d57b54e..0365c297e8 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -99,20 +99,41 @@ org_gnome_prefer_plain_multipart_alternative(void *ep, EMFormatHookTarget *t)
int i, nparts, partidlen, displayid = 0;
if (epp_mode == EPP_NORMAL) {
+ gboolean have_plain = FALSE;
+
/* 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. */
+ can offer HTML, then offer it, regardless of position in multipart.
+ But do this only when have text/plain in a list, because otherwise it
+ can be something else (like outlooks meeting invites with only text/html
+ part and calendar part).
+ */
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts; i++) {
+ CamelContentType *content_type;
+
part = camel_multipart_get_part (mp, i);
- if (part && camel_content_type_is (camel_mime_part_get_content_type (part), "text", "html")) {
+
+ if (!part)
+ continue;
+
+ content_type = camel_mime_part_get_content_type (part);
+
+ if (camel_content_type_is (content_type, "text", "html")) {
displayid = i;
display_part = part;
- break;
+
+ if (have_plain)
+ break;
+ } else if (camel_content_type_is (content_type, "text", "plain")) {
+ have_plain = TRUE;
+
+ if (display_part)
+ break;
}
}
- if (display_part) {
+ if (display_part && have_plain) {
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);