From 19ffc6d23e23f6b59f6c62b816647c9e7f9f54e9 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 16 Jul 2003 20:46:19 +0000 Subject: We don't have camel_pgp_mime_is_rfc2015_encrypted() anymore so just look 2003-07-16 Jeffrey Stedfast * mail-format.c (handle_multipart_encrypted): We don't have camel_pgp_mime_is_rfc2015_encrypted() anymore so just look at the protocol for now. (mail_format_data_wrapper_write_to_stream): Updated for the new way camel handles content objects. svn path=/trunk/; revision=21844 --- mail/ChangeLog | 2 ++ mail/mail-format.c | 70 +++++++++++++++++------------------------------------- 2 files changed, 24 insertions(+), 48 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 7e64d8979a..b9ace9de54 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -3,6 +3,8 @@ * mail-format.c (handle_multipart_encrypted): We don't have camel_pgp_mime_is_rfc2015_encrypted() anymore so just look at the protocol for now. + (mail_format_data_wrapper_write_to_stream): Updated for the new + way camel handles content objects. 2003-07-15 Federico Mena Quintero diff --git a/mail/mail-format.c b/mail/mail-format.c index aea04ff5b7..2262a25385 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -3,7 +3,7 @@ * Authors: Dan Winship * Jeffrey Stedfast * - * Copyright 2000, 2003 Ximian, Inc. + * Copyright 2000-2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -1120,59 +1120,33 @@ ssize_t mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay *mail_display, CamelStream *stream) { CamelStreamFilter *filtered_stream; + CamelMimeFilterCharset *filter; + CamelContentType *content_type; + GConfClient *gconf; ssize_t written; + char *charset; + + gconf = mail_config_get_gconf_client (); + + content_type = camel_data_wrapper_get_mime_type_field (wrapper); + + /* find out the charset the user wants to override to */ + if (mail_display && mail_display->charset) + charset = g_strdup (mail_display->charset); + else if (content_type && (charset = (char *) header_content_type_param (content_type, "charset"))) + charset = g_strdup (charset); + else + charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); filtered_stream = camel_stream_filter_new_with_stream (stream); - if (wrapper->rawtext || (mail_display && mail_display->charset)) { - CamelMimeFilterCharset *filter; - CamelContentType *content_type; - GConfClient *gconf; - char *charset; - - gconf = mail_config_get_gconf_client (); - - content_type = camel_data_wrapper_get_mime_type_field (wrapper); - - if (!wrapper->rawtext) { - /* data wrapper had been successfully converted to UTF-8 using the mime - part's charset, but the user thinks he knows best so we'll let him - shoot himself in the foot here... */ - - /* get the original charset of the mime part */ - charset = (char *) (content_type ? header_content_type_param (content_type, "charset") : NULL); - if (!charset) - charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); - else - charset = g_strdup (charset); - - /* since the content is already in UTF-8, we need to decode into the - original charset before we can convert back to UTF-8 using the charset - the user is overriding with... */ - if ((filter = camel_mime_filter_charset_new_convert ("utf-8", charset))) { - camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); - camel_object_unref (filter); - } - - g_free (charset); - } - - /* find out the charset the user wants to override to */ - if (mail_display && mail_display->charset) - charset = g_strdup (mail_display->charset); - else if (content_type && (charset = (char *) header_content_type_param (content_type, "charset"))) - charset = g_strdup (charset); - else - charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); - - if ((filter = camel_mime_filter_charset_new_convert (charset, "utf-8"))) { - camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); - camel_object_unref (filter); - } - - g_free (charset); + if ((filter = camel_mime_filter_charset_new_convert (charset, "UTF-8"))) { + camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); + camel_object_unref (filter); } + g_free (charset); + written = camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); camel_stream_flush (CAMEL_STREAM (filtered_stream)); camel_object_unref (filtered_stream); -- cgit