diff options
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r-- | camel/camel-mime-utils.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index f1dbe6de4c..18c005e3fb 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -40,6 +40,8 @@ #include <ctype.h> #include <errno.h> +#include <libgnomevfs/gnome-vfs.h> + #include "camel-mime-utils.h" #include "camel-charset-map.h" @@ -3089,3 +3091,22 @@ header_msgid_generate (void) return g_strdup_printf ("%d.%d.%d.camel@%s.%s", (gint) time (NULL), getpid (), count++, host, domain); } + +gchar * +mime_guess_type_from_file_name (const gchar *file_name) +{ + GnomeVFSFileInfo info; + GnomeVFSResult result; + + result = gnome_vfs_get_file_info (file_name, &info, + GNOME_VFS_FILE_INFO_GET_MIME_TYPE | + GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + if (result == GNOME_VFS_OK) { + gchar *type; + + type = g_strdup (gnome_vfs_file_info_get_mime_type (&info)); + gnome_vfs_file_info_unref (&info); + return type; + } else + return NULL; +} |