aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-01-29 17:45:59 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-01-29 17:45:59 +0800
commitcd7969810436f5f4074736e72e6f68fac9469074 (patch)
tree7767882422251390ce1c9c06300bf662a2ffdc2b /mail
parent1d8c2ddc164c6b4c90f58310b385655ccdd98667 (diff)
downloadgsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.tar
gsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.tar.gz
gsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.tar.bz2
gsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.tar.lz
gsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.tar.xz
gsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.tar.zst
gsoc2013-evolution-cd7969810436f5f4074736e72e6f68fac9469074.zip
Fixes a bug i can't find right now
2004-01-29 Not Zed <NotZed@Ximian.com> * em-format-html-display.c (efhd_attachment_button): check the snooped type for the icon/etc. (efhd_format_attachment): save the snooped type in the attach_puri. * em-format-html.c (efh_text_plain): If we had a snooped type, use that as the base type, rather than octet-stream, which will cause an attachment in attachment loop. * em-format.c (em_format_part_as): save the current snooped mime type in a stack if we had any. svn path=/trunk/; revision=24515
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/em-format-html-display.c10
-rw-r--r--mail/em-format-html.c12
-rw-r--r--mail/em-format.c7
-rw-r--r--mail/em-format.h2
5 files changed, 41 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1151a322d7..adb87f4d10 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,19 @@
2004-01-29 Not Zed <NotZed@Ximian.com>
+ * em-format-html-display.c (efhd_attachment_button): check the
+ snooped type for the icon/etc.
+ (efhd_format_attachment): save the snooped type in the
+ attach_puri.
+
+ * em-format-html.c (efh_text_plain): If we had a snooped type, use
+ that as the base type, rather than octet-stream, which will cause
+ an attachment in attachment loop.
+
+ * em-format.c (em_format_part_as): save the current snooped mime
+ type in a stack if we had any.
+
+2004-01-29 Not Zed <NotZed@Ximian.com>
+
** See bug #53320 and probably others
* message-list.c (message_list_set_folder): NULL out
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index d904bf33a6..64fefde3fe 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -116,6 +116,8 @@ struct _attach_puri {
const EMFormatHandler *handle;
+ const char *snoop_mime_type;
+
/* for the > and V buttons */
GtkWidget *forward, *down;
/* currently no way to correlate this data to the frame :( */
@@ -1320,8 +1322,11 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
gtk_container_add((GtkContainer *)button, hbox);
gtk_box_pack_start((GtkBox *)mainbox, button, TRUE, TRUE, 0);
- /* FIXME: loses any snoop info */
- simple_type = camel_content_type_simple (((CamelDataWrapper *)pobject->part)->mime_type);
+ /* Check for snooped type to get the right icon/processing */
+ if (info->snoop_mime_type)
+ simple_type = g_strdup(info->snoop_mime_type);
+ else
+ simple_type = camel_content_type_simple (((CamelDataWrapper *)pobject->part)->mime_type);
camel_strdown(simple_type);
/* FIXME: offline parts, just get icon */
@@ -1547,6 +1552,7 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_button);
info->handle = handle;
info->shown = em_format_is_inline(emf, info->puri.part) && handle != NULL;
+ info->snoop_mime_type = emf->snoop_mime_type;
camel_stream_write_string(stream,
"<table height=6><tr><td><a></a></td></tr></table>\n"
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 441dc854e8..a619040ef0 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -701,11 +701,20 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
if (mp == NULL) {
EMInlineFilter *inline_filter;
CamelStream *null;
+ CamelContentType *ct;
+
+ /* if we had to snoop the part type to get here, then
+ * use that as the base type, yuck */
+ if (((EMFormat *)efh)->snoop_mime_type == NULL
+ || (ct = camel_content_type_decode(((EMFormat *)efh)->snoop_mime_type)) == NULL) {
+ ct = dw->mime_type;
+ camel_content_type_ref(ct);
+ }
null = camel_stream_null_new();
filtered_stream = camel_stream_filter_new_with_stream(null);
camel_object_unref(null);
- inline_filter = em_inline_filter_new(camel_mime_part_get_encoding(part), dw->mime_type);
+ inline_filter = em_inline_filter_new(camel_mime_part_get_encoding(part), ct);
camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)inline_filter);
camel_data_wrapper_write_to_stream(dw, (CamelStream *)filtered_stream);
camel_stream_close((CamelStream *)filtered_stream);
@@ -713,6 +722,7 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
mp = em_inline_filter_get_multipart(inline_filter);
g_hash_table_insert(efh->priv->text_inline_parts, part, mp);
camel_object_unref(inline_filter);
+ camel_content_type_unref(ct);
}
filtered_stream = camel_stream_filter_new_with_stream(stream);
diff --git a/mail/em-format.c b/mail/em-format.c
index ef6678dfb3..7eb8794827 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -477,10 +477,13 @@ void
em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type)
{
const EMFormatHandler *handle = NULL;
+ const char *snoop_save = emf->snoop_mime_type;
+
+ emf->snoop_mime_type = NULL;
if (mime_type != NULL) {
if (g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0)
- mime_type = emf_snoop_part(part);
+ emf->snoop_mime_type = mime_type = emf_snoop_part(part);
handle = em_format_find_handler(emf, mime_type);
if (handle == NULL)
@@ -490,6 +493,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
&& !em_format_is_attachment(emf, part)) {
d(printf("running handler for type '%s'\n", mime_type));
handle->handler(emf, stream, part, handle);
+ emf->snoop_mime_type = snoop_save;
return;
}
d(printf("this type is an attachment? '%s'\n", mime_type));
@@ -498,6 +502,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
}
((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_attachment(emf, stream, part, mime_type, handle);
+ emf->snoop_mime_type = snoop_save;
}
void
diff --git a/mail/em-format.h b/mail/em-format.h
index 5d41ae0020..a5fd08f55c 100644
--- a/mail/em-format.h
+++ b/mail/em-format.h
@@ -112,6 +112,8 @@ struct _EMFormat {
struct _CamelSession *session; /* session, used for authentication when required */
struct _CamelURL *base; /* current location (base url) */
+ const char *snoop_mime_type; /* if we snooped an application/octet-stream type, what we snooped */
+
/* for forcing inlining */
GHashTable *inline_table;