aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format.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-format.c
parent1f24a7b807ce7e466971f5c75ee4d43e4dab37a3 (diff)
downloadgsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar
gsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar.gz
gsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar.bz2
gsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar.lz
gsoc2013-evolution-dbd786a2dded4808518c91cb2414d173e50f5aa9.tar.xz
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-format.c')
-rw-r--r--mail/em-format.c52
1 files changed, 2 insertions, 50 deletions
diff --git a/mail/em-format.c b/mail/em-format.c
index e585897d94..35fed724ca 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -50,11 +50,11 @@
#include <camel/camel-mime-filter-windows.h>
#include "em-format.h"
+#include "em-utils.h"
#define d(x)
static void emf_builtin_init(EMFormatClass *);
-static const char *emf_snoop_part(CamelMimePart *part);
static const EMFormatHandler *emf_find_handler(EMFormat *emf, const char *mime_type);
static void emf_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *emfsource);
@@ -485,7 +485,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
if (mime_type != NULL) {
if (g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0)
- emf->snoop_mime_type = mime_type = emf_snoop_part(part);
+ emf->snoop_mime_type = mime_type = em_utils_snoop_type(part);
handle = em_format_find_handler(emf, mime_type);
if (handle == NULL)
@@ -1004,54 +1004,6 @@ em_format_describe_part(CamelMimePart *part, const char *mime_type)
/* ********************************************************************** */
-/* originally from mail-identify.c */
-static const char *
-emf_snoop_part(CamelMimePart *part)
-{
- const char *filename, *name_type = NULL, *magic_type = NULL;
- CamelDataWrapper *dw;
-
- filename = camel_mime_part_get_filename (part);
- if (filename) {
- /* GNOME-VFS will misidentify TNEF attachments as MPEG */
- if (!strcmp (filename, "winmail.dat"))
- return "application/vnd.ms-tnef";
-
- name_type = gnome_vfs_mime_type_from_name(filename);
- }
-
- dw = camel_medium_get_content_object((CamelMedium *)part);
- if (!camel_data_wrapper_is_offline(dw)) {
- CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
-
- if (camel_data_wrapper_decode_to_stream(dw, (CamelStream *)mem) > 0)
- magic_type = gnome_vfs_get_mime_type_for_data(mem->buffer->data, mem->buffer->len);
- camel_object_unref(mem);
- }
-
- d(printf("snooped part, magic_type '%s' name_type '%s'\n", magic_type, name_type));
-
- /* If GNOME-VFS doesn't recognize the data by magic, but it
- * contains English words, it will call it text/plain. If the
- * filename-based check came up with something different, use
- * that instead and if it returns "application/octet-stream"
- * try to do better with the filename check.
- */
-
- if (magic_type) {
- if (name_type
- && (!strcmp(magic_type, "text/plain")
- || !strcmp(magic_type, "application/octet-stream")))
- return name_type;
- else
- return magic_type;
- } else
- return name_type;
-
- /* We used to load parts to check their type, we dont anymore,
- see bug #11778 for some discussion */
-}
-
#ifdef ENABLE_SMIME
static void
emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)