aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Doulik <rodo@helixcode.com>2000-11-08 21:04:59 +0800
committerRadek Doulik <rodo@src.gnome.org>2000-11-08 21:04:59 +0800
commit413284362ffbc5185e72dd2e246ba88f912ffbdb (patch)
treeafda74bae4af39be83a1bf854ab3ec6e9a0a848f
parent494b8db2bc3146db573f45ce7a74f63c1472a7ee (diff)
downloadgsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar
gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.gz
gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.bz2
gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.lz
gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.xz
gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.zst
gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.zip
new function, moved from composer
2000-11-08 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (mime_guess_type_from_file_name): new function, moved from composer svn path=/trunk/; revision=6506
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-mime-utils.c21
-rw-r--r--camel/camel-mime-utils.h3
3 files changed, 29 insertions, 0 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 0caf7e1aab..e489b8938d 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-08 Radek Doulik <rodo@helixcode.com>
+
+ * camel-mime-utils.c (mime_guess_type_from_file_name): new
+ function, moved from composer
+
2000-11-08 Not Zed <NotZed@HelixCode.com>
* camel-mime-message.c (find_best_encoding): Keep track of the
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;
+}
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
index e829a17093..33a70cc908 100644
--- a/camel/camel-mime-utils.h
+++ b/camel/camel-mime-utils.h
@@ -183,4 +183,7 @@ int quoted_decode_step(unsigned char *in, int len, unsigned char *out, int *save
int quoted_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save);
int quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state, int *save);
+gchar * mime_guess_type_from_file_name (const gchar *file_name);
+
+
#endif /* ! _CAMEL_MIME_UTILS_H */