[evolution/gnome-2-28] Bug #468736 - Prevent recursion in em-format
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/gnome-2-28] Bug #468736 - Prevent recursion in em-format
- Date: Tue, 24 Nov 2009 11:11:23 +0000 (UTC)
commit 323a524026fab0e5d29795da349387f1e5d5d2de
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 24 12:10:32 2009 +0100
Bug #468736 - Prevent recursion in em-format
mail/em-format-html.c | 8 +++++++-
mail/em-format.c | 9 ++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index bf3bec0..066c4f6 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -731,10 +731,16 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
const gchar *format;
guint32 flags;
gint i, count, len;
+ gchar *meta;
+ gboolean is_fallback;
struct _EMFormatHTMLCache *efhc;
flags = efh->text_html_flags;
+ meta = camel_object_meta_get (part, "EMF-Fallback");
+ is_fallback = meta != NULL;
+ g_free (meta);
+
dw = camel_medium_get_content_object((CamelMedium *)part);
/* Check for RFC 2646 flowed text. */
@@ -802,7 +808,7 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
continue;
type = camel_mime_part_get_content_type(newpart);
- if (camel_content_type_is (type, "text", "*") && !camel_content_type_is(type, "text", "calendar")) {
+ if (camel_content_type_is (type, "text", "*") && (is_fallback || !camel_content_type_is (type, "text", "calendar"))) {
camel_stream_printf (stream,
"<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff, efh->text_colour & 0xffffff);
diff --git a/mail/em-format.c b/mail/em-format.c
index 1cc6468..bfe24c1 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -612,6 +612,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
g_free(basestr);
if (mime_type != NULL) {
+ gboolean is_fallback = FALSE;
if (g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0) {
emf->snoop_mime_type = mime_type = em_utils_snoop_type(part);
if (mime_type == NULL)
@@ -619,13 +620,19 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
}
handle = em_format_find_handler(emf, mime_type);
- if (handle == NULL)
+ if (handle == NULL) {
handle = em_format_fallback_handler(emf, mime_type);
+ is_fallback = TRUE;
+ }
if (handle != NULL
&& !em_format_is_attachment(emf, part)) {
d(printf("running handler for type '%s'\n", mime_type));
+ if (is_fallback)
+ camel_object_meta_set (part, "EMF-Fallback", "1");
handle->handler(emf, stream, part, handle);
+ if (is_fallback)
+ camel_object_meta_set (part, "EMF-Fallback", NULL);
goto finish;
}
d(printf("this type is an attachment? '%s'\n", mime_type));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]