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.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/mail/mail-identify.c b/mail/mail-identify.c
index 0ef8b7e9e3..c51831fc63 100644
--- a/mail/mail-identify.c
+++ b/mail/mail-identify.c
@@ -53,7 +53,6 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
const char *filename, *magic_type = NULL;
CamelDataWrapper *data;
char *name_type = NULL;
- char *uri;
filename = camel_mime_part_get_filename (part);
if (filename) {
@@ -61,15 +60,13 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
if (!strcmp (filename, "winmail.dat"))
return g_strdup ("application/vnd.ms-tnef");
- uri = gnome_vfs_get_uri_from_local_path (filename);
- name_type = gnome_vfs_get_mime_type (uri);
- g_free (uri);
+ name_type = gnome_vfs_get_mime_type_from_name (filename);
}
-
+
data = camel_medium_get_content_object (CAMEL_MEDIUM (part));
if (!camel_data_wrapper_is_offline (data))
magic_type = identify_by_magic (data, md);
-
+
if (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
@@ -78,31 +75,31 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
*/
if (!strcmp (magic_type, "text/plain"))
return name_type;
-
+
/* If if returns "application/octet-stream" try to
* do better with the filename check.
*/
if (!strcmp (magic_type, "application/octet-stream"))
return name_type;
}
-
+
/* If the MIME part data was online, and the magic check
* returned something, use that, since it's more reliable.
*/
if (magic_type) {
- g_free(name_type);
+ g_free (name_type);
return g_strdup (magic_type);
}
-
+
/* Otherwise try guessing based on the filename */
if (name_type)
return name_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 0
/* 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.
@@ -114,7 +111,7 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
if (camel_data_wrapper_is_offline (data))
mail_content_loaded (data, md, TRUE, NULL, NULL, NULL);
#endif
-
+
return NULL;
}