aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-inline-filter.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-19 15:02:12 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-19 15:02:12 +0800
commitdbd786a2dded4808518c91cb2414d173e50f5aa9 (patch)
tree7e19c801ded9e36ee5ea22ff4f95c97f2582b04e /mail/em-inline-filter.c
parent1f24a7b807ce7e466971f5c75ee4d43e4dab37a3 (diff)
downloadgsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar.gz
gsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar.zst
gsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.zip
if we end up with an application/octet-stream part, pre-snoop it so we set
2004-05-19 Not Zed <NotZed@Ximian.com> * em-inline-filter.c (emif_add_part): if we end up with an application/octet-stream part, pre-snoop it so we set the right mime type to start with. Fixes #58554. * em-format.c (emf_snoop_part): removed, now in em-utils. * em-utils.c (em_utils_snoop_type): rah rah, snoop a mime part's type. * em-format-html.c (efh_text_plain): Revert jeff's fix for #56290. Ugh, we already have all the citation info in local data. Removed the need for gconf too. svn path=/trunk/; revision=25974
Diffstat (limited to 'mail/em-inline-filter.c')
-rw-r--r--mail/em-inline-filter.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c
index 9fc4294139..4b21cee46d 100644
--- a/mail/em-inline-filter.c
+++ b/mail/em-inline-filter.c
@@ -31,6 +31,8 @@
#include <camel/camel-multipart.h>
#include <camel/camel-stream-mem.h>
+#include "em-utils.h"
+
#define d(x)
static void em_inline_filter_class_init (EMInlineFilterClass *klass);
@@ -120,6 +122,7 @@ emif_add_part(EMInlineFilter *emif, const char *data, int len)
CamelStream *mem;
CamelDataWrapper *dw;
CamelMimePart *part;
+ const char *mimetype;
if (emif->state == EMIF_PLAIN)
type = emif->base_encoding;
@@ -144,12 +147,22 @@ emif_add_part(EMInlineFilter *emif, const char *data, int len)
camel_mime_part_set_encoding(part, type);
camel_object_unref(dw);
- if (emif->filename) {
+ if (emif->filename)
camel_mime_part_set_filename(part, emif->filename);
- g_free(emif->filename);
- emif->filename = NULL;
+
+ /* pre-snoop the mime type of unknown objects, and poke and hack it into place */
+ if (camel_content_type_is(dw->mime_type, "application", "octet-stream")
+ && (mimetype = em_utils_snoop_type(part))
+ && strcmp(mimetype, "application/octet-stream") != 0) {
+ camel_data_wrapper_set_mime_type(dw, mimetype);
+ camel_mime_part_set_content_type(part, mimetype);
+ if (emif->filename)
+ camel_mime_part_set_filename(part, emif->filename);
}
+ g_free(emif->filename);
+ emif->filename = NULL;
+
emif->parts = g_slist_append(emif->parts, part);
}