aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part-utils.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-08-16 04:57:30 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-08-16 04:57:30 +0800
commit87b5d92a77b11d4441b786763b5f409d903cf9c3 (patch)
tree81ea1325b20fda4a84d2815e86e684b65304053b /camel/camel-mime-part-utils.c
parent405b846e5b5ab98ecb0d1a3545df3972df044730 (diff)
downloadgsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.tar
gsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.tar.gz
gsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.tar.bz2
gsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.tar.lz
gsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.tar.xz
gsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.tar.zst
gsoc2013-evolution-87b5d92a77b11d4441b786763b5f409d903cf9c3.zip
** See bug #47634.
2003-08-15 Not Zed <NotZed@Ximian.com> ** See bug #47634. * tests/lib/messages.c (test_message_compare): check write_to_stream returns. (message_dump_rec): helper to dump message structure. * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): dont set content encoding here. (camel_mime_part_construct_content_from_parser): set it here instead, on every part. basically same as setting the mime_type_field always. * camel-multipart-signed.c (camel_multipart_signed_class_init): * camel-mime-message.c (camel_mime_message_class_init): * camel-multipart.c (camel_multipart_class_init): override decode_to_stream to always do the same as write_to_stream, since we can never be encoded. svn path=/trunk/; revision=22252
Diffstat (limited to 'camel/camel-mime-part-utils.c')
-rw-r--r--camel/camel-mime-part-utils.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 92769b3083..0f80507fd7 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -57,16 +57,13 @@
static void
simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser *mp)
{
- char *encoding, *buf;
+ char *buf;
GByteArray *buffer;
CamelStream *mem;
size_t len;
d(printf ("simple_data_wrapper_construct_from_parser()\n"));
- /* first, work out conversion, if any, required, we dont care about what we dont know about */
- encoding = header_content_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL));
-
/* read in the entire content */
buffer = g_byte_array_new ();
while (camel_mime_parser_step (mp, &buf, &len) != HSCAN_BODY_END) {
@@ -79,11 +76,6 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
mem = camel_stream_mem_new_with_byte_array (buffer);
camel_data_wrapper_construct_from_stream (dw, mem);
camel_object_unref (mem);
-
- if (encoding) {
- dw->encoding = camel_mime_part_encoding_from_string (encoding);
- g_free (encoding);
- }
}
/* This replaces the data wrapper repository ... and/or could be replaced by it? */
@@ -92,8 +84,11 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
{
CamelDataWrapper *content = NULL;
CamelContentType *ct;
-
+ char *encoding;
+
ct = camel_mime_parser_content_type (mp);
+
+ encoding = header_content_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL));
switch (camel_mime_parser_state (mp)) {
case HSCAN_HEADER:
@@ -129,9 +124,14 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
}
if (content) {
+ if (encoding)
+ content->encoding = camel_mime_part_encoding_from_string (encoding);
+
/* would you believe you have to set this BEFORE you set the content object??? oh my god !!!! */
camel_data_wrapper_set_mime_type_field (content, camel_mime_part_get_content_type (dw));
camel_medium_set_content_object ((CamelMedium *)dw, content);
camel_object_unref (content);
}
+
+ g_free (encoding);
}