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
This commit is contained in:
Radek Doulik
2000-11-08 13:04:59 +00:00
committed by Radek Doulik
parent 494b8db2bc
commit 413284362f
3 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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 */