diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 3 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 2 | ||||
-rw-r--r-- | mail/mail-ops.c | 36 |
3 files changed, 39 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 3bf9738592..1d9a826bb9 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,8 @@ 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. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index e7cf846fa9..816f973ae3 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1652,7 +1652,7 @@ save_msg_ok (GtkWidget *widget, gpointer user_data) if (path[0] == '\0') return; - fd = open (path, O_RDONLY); + fd = open (path, O_RDONLY); if (fd != -1) { GtkWidget *dialog; GtkWidget *text; 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 |