aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-04-13 03:55:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-13 03:55:53 +0800
commit51e5ae5524c778309800530e1e25fdf74f2226da (patch)
treecb4b49e313d0ac80d9b47c3f2ffe6e097fe08442 /em-format
parent742b2d946553f3317a7cecc21f735441c37e4478 (diff)
downloadgsoc2013-evolution-51e5ae5524c778309800530e1e25fdf74f2226da.tar.gz
gsoc2013-evolution-51e5ae5524c778309800530e1e25fdf74f2226da.tar.zst
gsoc2013-evolution-51e5ae5524c778309800530e1e25fdf74f2226da.zip
Adapt to Camel API changes.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/em-format/em-format.c b/em-format/em-format.c
index c348e0f19f..ca4a269fcf 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -2036,18 +2036,27 @@ em_format_snoop_type (CamelMimePart *part)
name_type = e_util_guess_mime_type (filename, FALSE);
dw = camel_medium_get_content ((CamelMedium *)part);
- if (!camel_data_wrapper_is_offline(dw)) {
- CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
+ if (!camel_data_wrapper_is_offline (dw)) {
+ GByteArray *byte_array;
+ CamelStream *stream;
- if (camel_data_wrapper_decode_to_stream(dw, (CamelStream *)mem) > 0) {
- gchar *ct = g_content_type_guess (filename, mem->buffer->data, mem->buffer->len, NULL);
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
- if (ct)
- magic_type = g_content_type_get_mime_type (ct);
+ if (camel_data_wrapper_decode_to_stream (dw, stream) > 0) {
+ gchar *content_type;
- g_free (ct);
+ content_type = g_content_type_guess (
+ filename, byte_array->data,
+ byte_array->len, NULL);
+
+ if (content_type != NULL)
+ magic_type = g_content_type_get_mime_type (content_type);
+
+ g_free (content_type);
}
- camel_object_unref(mem);
+
+ camel_object_unref (stream);
}
d(printf("snooped part, magic_type '%s' name_type '%s'\n", magic_type, name_type));