aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-21 03:22:20 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-21 03:22:20 +0800
commit66ec2f9d1ef656f558173d69cc5f917743fb3dfb (patch)
tree32f09c3b5e035316f696c43a38219fb7125671ba /mail/mail-ops.c
parent704277492d619920abf2e0336d8da7a7602ee98c (diff)
downloadgsoc2013-evolution-66ec2f9d1ef656f558173d69cc5f917743fb3dfb.tar.gz
gsoc2013-evolution-66ec2f9d1ef656f558173d69cc5f917743fb3dfb.tar.zst
gsoc2013-evolution-66ec2f9d1ef656f558173d69cc5f917743fb3dfb.zip
Convert all textual parts to 8bit before saving. Fixes bug #10388.
2001-09-20 Jeffrey Stedfast <fejj@ximian.com> * mail-ops.c (save_messages_save): Convert all textual parts to 8bit before saving. Fixes bug #10388. * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Oops, don't free memory that we don't own. svn path=/trunk/; revision=13013
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 89967b7488..569160e68e 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1862,6 +1862,38 @@ build_from(struct _header_raw *header)
}
static void
+save_prepare_part (CamelMimePart *mime_part)
+{
+ CamelDataWrapper *wrapper;
+ int parts, i;
+
+ wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+ if (!wrapper)
+ return;
+
+ if (CAMEL_IS_MULTIPART (wrapper)) {
+ parts = camel_multipart_get_number (CAMEL_MULTIPART (wrapper));
+ for (i = 0; i < parts; i++) {
+ CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (wrapper), i);
+
+ save_prepare_part (part);
+ }
+ } else {
+ if (CAMEL_IS_MIME_MESSAGE (wrapper)) {
+ /* prepare the message parts' subparts */
+ save_prepare_part (CAMEL_MIME_PART (wrapper));
+ } else {
+ CamelContentType *type;
+
+ /* We want to save textual parts as 8bit instead of encoded */
+ type = camel_data_wrapper_get_mime_type_field (wrapper);
+ if (header_content_type_is (type, "text", "*"))
+ camel_mime_part_set_encoding (mime_part, CAMEL_MIME_PART_ENCODING_8BIT);
+ }
+ }
+}
+
+static void
save_messages_save (struct _mail_msg *mm)
{
struct _save_messages_msg *m = (struct _save_messages_msg *)mm;
@@ -1892,7 +1924,9 @@ save_messages_save (struct _mail_msg *mm)
camel_operation_progress(mm->cancel, pc);
if (message == NULL)
break;
-
+
+ save_prepare_part (CAMEL_MIME_PART (message));
+
/* we need to flush after each stream write since we are writing to the same fd */
from = build_from(((CamelMimePart *)message)->headers);
if (camel_stream_write_string(stream, from) == -1