aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-identify.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-identify.c')
-rw-r--r--mail/mail-identify.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/mail/mail-identify.c b/mail/mail-identify.c
deleted file mode 100644
index 891209186a..0000000000
--- a/mail/mail-identify.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Dan Winship <danw@ximian.com>
- *
- * Copyright 2000, Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-mime-sniff-buffer.h>
-#include "mail.h"
-
-static const char *identify_by_magic (CamelDataWrapper *data, MailDisplay *md);
-
-/**
- * mail_identify_mime_part:
- * @part: a CamelMimePart
- * @md: the MailDisplay @part is being shown in
- *
- * Try to identify the MIME type of the data in @part (which presumably
- * doesn't have a useful Content-Type).
- **/
-char *
-mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
-{
- const char *filename, *type;
- CamelDataWrapper *data;
-
- /* If the MIME part data is online, try file magic first,
- * since it's more reliable.
- */
- data = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- if (!camel_data_wrapper_is_offline (data)) {
- type = identify_by_magic (data, md);
- if (type)
- return g_strdup (type);
- }
-
- /* Try identifying based on name in Content-Type or
- * filename in Content-Disposition.
- */
- filename = camel_mime_part_get_filename (part);
- if (filename) {
- type = gnome_vfs_mime_type_from_name_or_default (filename,
- NULL);
- if (type)
- return g_strdup (type);
- }
-
- /* Another possibility to try is the x-mac-type / x-mac-creator
- * parameter to Content-Type used by some Mac email clients. That
- * would require a Mac type to mime type conversion table.
- */
-
- /* If the data part is offline, then we didn't try magic
- * before, so force it to be loaded so we can try again later.
- * FIXME: In a perfect world, we would not load the content
- * just to identify the MIME type.
- */
- if (camel_data_wrapper_is_offline (data))
- mail_content_loaded (data, md);
-
- return NULL;
-}
-
-static const char *
-identify_by_magic (CamelDataWrapper *data, MailDisplay *md)
-{
- GnomeVFSMimeSniffBuffer *sniffer;
- CamelStream *memstream;
- const char *type;
- GByteArray *ba;
-
- ba = g_byte_array_new ();
- memstream = camel_stream_mem_new_with_byte_array (ba);
- camel_data_wrapper_write_to_stream (data, memstream);
- if (ba->len) {
- sniffer = gnome_vfs_mime_sniff_buffer_new_from_memory (ba->data, ba->len);
- type = gnome_vfs_get_mime_type_for_buffer (sniffer);
- gnome_vfs_mime_sniff_buffer_free (sniffer);
- } else
- type = NULL;
- camel_object_unref (CAMEL_OBJECT (memstream));
-
- return type;
-}
an> * - Update to git snapshot 55c0c3eashish2017-03-083-5/+7 * editors/emacs-devel: Pull in latest commit to master branch.jrm2017-02-103-5/+7 * editors/emacs-devel: Update to latest commit on master branchjrm2017-02-022-5/+5 * editors/emacs-devel: Update to latest commit on master branch.jrm2017-01-244-9/+27 * The output of tools like awk, date, sort, tr,... depends on the currenttijl2017-01-181-4/+1 * editors/emacs-devel: Update to pull in new concurrency features.jrm2016-12-253-93/+33 * Bump PORTREVISIONS for ports depending on the canonical version of GCC andgerald2016-11-201-0/+1 * Now builds on sparc64. Delete ia64 line as support was dropped.linimon2016-11-041-3/+0 * Cleanup USE_GITHUB usage.mat2016-10-261-1/+0 * ${RM} already has -f.mat2016-10-211-1/+1 * - Fix typo, happened in r423103ashish2016-10-021-1/+1 * GNU Emacs updatesashish2016-10-025-223/+95 * - Update to 25.1-rc2ashish2016-08-222-4/+4 * editors/emacs-devel:ashish2016-07-272-7/+8 * - Add *_IMPLIES for various options to track implicitly enabled OPTIONSashish2016-06-271-23/+30 * - Update to 25.0.95ashish2016-06-133-6/+6 * - Update to 25.0.94ashish2016-05-303-5/+5 * editors/emacs-devel[1]:ashish2016-05-023-149/+141 * Remove ${PORTSDIR}/ from dependencies, categories d, e, f, and g.mat2016-04-011-12/+12 * - Update security/gnutls to 3.4.10.tijl2016-03-271-0/+1 * - Update to latest pretest version 25.0.92ashish2016-03-083-6/+10 * - Update to latest pretest 25.0.90[1]ashish2016-02-084-20/+43 * - Update to git revision 0a7ad07[1]ashish2016-01-043-59/+66 * Update giflib to 5.1.1antoine2015-12-041-0/+1 * - Update to git revision af40b76ashish2015-11-305-3924/+3983 * Mark as broken on sparc64: fails to build.linimon2015-09-271-0/+1 * It seems some people keep adding $FreeBSD$ to patch files.mat2015-09-161-3/+0 * - Update to git snapshot a9bb9d8fashish2015-08-103-9/+28 * - Mark BROKEN on 9.x:amdmi32015-06-261-0/+2 * Convert to USES=jpegantoine2015-06-231-1/+1 * Remove $FreeBSD$ from patches files in categories a-j.mat2015-05-221-3/+0 * Cleanup DIST* variables.mat2015-05-121-4/+3 * GNU Emacs Updatesashish2015-04-273-7/+13 * - Update to git snapshot 4a50af93ashish2015-03-234-7/+310 * - Update to git snapshot 5c9ad35fashish2015-02-083-10/+32 * Update ImageMagick to 6.9.0.4.kwm2015-01-191-2/+2 * Update graphics/giflib to 5.0.5antoine2015-01-151-1/+1 * Bump portrevision after png updatebapt2014-12-261-1/+1 * Change libpng15.so to libpng.so in LIB_DEPENDS to prepare the upgradeantoine2014-12-261-1/+1 * Cleanup plistbapt2014-12-211-15/+0 * Replace USES=libtool:oldver with USES=libtool or USES=libtool:keepla intijl2014-12-091-1/+1 * - Fix pkg-install script to correctly install emacs games scores files[1]ashish2014-11-072-0/+8 * Remove * from LIB_DEPENDS lines and specify the default library namekwm2014-11-071-1/+1 * GNU Emacs Updatesashish2014-11-055-19/+4014 * Cleanup plistbapt2014-10-271-2/+0 * - Update to bzr snapshot revision 117676ashish2014-08-103-23/+21 * - Update to bzr snapshot revision 117564ashish2014-07-243-9/+6 * - Replace security/gnutls with security/gnutls3 and update to 3.2.15tijl2014-07-232-51/+4 * Remove some instances of WITHOUT_X11 and use an X11 OPTIONadamw2014-07-221-1/+1 * Allow to build with texinfo from portsantoine2014-06-29