diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-06-16 10:15:46 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-06-16 10:15:46 +0800 |
commit | c05c05cd3c32dc1253533e1c466a21fc6cf1b003 (patch) | |
tree | aae13dc1025d4904e500cd52b0507d809f5d35cb | |
parent | 8568b3caee7277c752d57e37430b8d76617e3ed3 (diff) | |
download | gsoc2013-evolution-c05c05cd3c32dc1253533e1c466a21fc6cf1b003.tar.gz gsoc2013-evolution-c05c05cd3c32dc1253533e1c466a21fc6cf1b003.tar.zst gsoc2013-evolution-c05c05cd3c32dc1253533e1c466a21fc6cf1b003.zip |
This code no longer needs to do charset conversion. Yay. Fixes bug #60225.
2004-06-15 Jeffrey Stedfast <fejj@ximian.com>
* mail-ops.c (save_part_save): This code no longer needs to do
charset conversion. Yay. Fixes bug #60225.
* em-utils.c (em_utils_save_part_to_file): Use the proper e-error
namespace.
svn path=/trunk/; revision=26358
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/em-utils.c | 2 | ||||
-rw-r--r-- | mail/mail-ops.c | 41 |
3 files changed, 17 insertions, 34 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 5f6c1b5fcc..5baa96fed8 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2004-06-15 Jeffrey Stedfast <fejj@ximian.com> + + * mail-ops.c (save_part_save): This code no longer needs to do + charset conversion. Yay. Fixes bug #60225. + + * em-utils.c (em_utils_save_part_to_file): Use the proper e-error + namespace. + 2004-06-15 Jeffrey Stedfast <fejj@novell.com> * em-folder-tree.c (emft_popup_copy_folder_selected): frombase is diff --git a/mail/em-utils.c b/mail/em-utils.c index 6cc735e981..b0bed74546 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -452,7 +452,7 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar } if (stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) { - e_error_run((GtkWindow *)parent, "no-write-path-notfile", filename, NULL); + e_error_run((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL); return FALSE; } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 75879716c9..0a112947d1 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -2002,50 +2002,25 @@ static void save_part_save (struct _mail_msg *mm) { struct _save_part_msg *m = (struct _save_part_msg *)mm; - CamelMimeFilterCharset *charsetfilter; - CamelContentType *content_type; - CamelStream *filtered_stream; - CamelStream *stream_fs; - CamelDataWrapper *data; - const char *charset; - - stream_fs = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if (stream_fs == NULL) { + CamelDataWrapper *content; + CamelStream *stream; + + if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) { camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create output file: %s:\n %s"), m->path, g_strerror (errno)); return; } - /* we only convert text/ parts, and we only convert if we have to - null charset param == us-ascii == utf8 always, and utf8 == utf8 obviously */ - /* this will also let "us-ascii that isn't really" parts pass out in - proper format, without us trying to treat it as what it isn't, which is - the same algorithm camel uses */ - - data = camel_medium_get_content_object (CAMEL_MEDIUM (m->part)); - content_type = camel_mime_part_get_content_type (m->part); - if (camel_content_type_is (content_type, "text", "*") - && (charset = camel_content_type_param (content_type, "charset")) - && strcasecmp (charset, "utf-8") != 0) { - charsetfilter = camel_mime_filter_charset_new_convert ("utf-8", charset); - filtered_stream = (CamelStream *) camel_stream_filter_new_with_stream (stream_fs); - camel_object_unref (CAMEL_OBJECT (stream_fs)); - if (charsetfilter) { - camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (charsetfilter)); - camel_object_unref (charsetfilter); - } - } else { - filtered_stream = stream_fs; - } + content = camel_medium_get_content_object (CAMEL_MEDIUM (m->part)); - if (camel_data_wrapper_decode_to_stream (data, filtered_stream) == -1 - || camel_stream_flush (filtered_stream) == -1) + if (camel_data_wrapper_decode_to_stream (content, stream) == -1 + || camel_stream_flush (stream) == -1) camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, _("Could not write data: %s"), g_strerror (errno)); - camel_object_unref (filtered_stream); + camel_object_unref (stream); } static void |