From b80a058e5534b668e11d7e6b31408acf52bf4bd3 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 22 Oct 2001 21:50:21 +0000 Subject: If we are kludging around a inline-pgp signed part, do some charset 2001-10-22 Jeffrey Stedfast * camel-pgp-mime.c (camel_pgp_mime_part_verify): If we are kludging around a inline-pgp signed part, do some charset conversion to protect any 8bit text. svn path=/trunk/; revision=13896 --- camel/ChangeLog | 6 ++++++ camel/camel-pgp-context.c | 2 +- camel/camel-pgp-mime.c | 26 +++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 4358626ed6..06e5e748bb 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2001-10-22 Jeffrey Stedfast + + * camel-pgp-mime.c (camel_pgp_mime_part_verify): If we are + kludging around a inline-pgp signed part, do some charset + conversion to protect any 8bit text. + 2001-10-22 * camel-filter-search.c, camel-folder-search.c (check_header): Use diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c index 79a53fd633..20d35d1a7b 100644 --- a/camel/camel-pgp-context.c +++ b/camel/camel-pgp-context.c @@ -1027,7 +1027,7 @@ pgp_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istream, desc = outbuf = g_new (unsigned char, outlen + 1); - locale = e_iconv_locale_charset(); + locale = e_iconv_locale_charset (); if (!locale) locale = "iso-8859-1"; diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c index 37b7cb1b58..b63f5af07e 100644 --- a/camel/camel-pgp-mime.c +++ b/camel/camel-pgp-mime.c @@ -29,6 +29,7 @@ #include "camel-mime-message.h" #include "camel-mime-filter-from.h" #include "camel-mime-filter-crlf.h" +#include "camel-mime-filter-charset.h" #include "camel-stream-filter.h" #include "camel-stream-mem.h" #include "camel-stream-fs.h" @@ -373,11 +374,30 @@ camel_pgp_mime_part_verify (CamelPgpContext *context, CamelMimePart *mime_part, camel_object_unref (CAMEL_OBJECT (crlf_filter)); camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (from_filter)); camel_object_unref (CAMEL_OBJECT (from_filter)); - + type = camel_mime_part_get_content_type (mime_part); - if (header_content_type_param (type, "x-inline-pgp-hack")) + if (header_content_type_param (type, "x-inline-pgp-hack")) { + /* this is a kludge around inline pgp signatures - basically, + the multipart/signed is faked - the original part (aka part #1) + is the original mime part and the signature is a copy of the + signature in part #1 */ + CamelMimeFilterCharset *charset_filter; + CamelContentType *content_type; + const char *charset; + + content_type = camel_mime_part_get_content_type (part); + charset = header_content_type_param (content_type, "charset"); + if (charset) { + charset_filter = camel_mime_filter_charset_new_convert ("utf-8", charset); + if (charset_filter) { + camel_stream_filter_add (filtered_stream, + CAMEL_MIME_FILTER (charset_filter)); + camel_object_unref (CAMEL_OBJECT (charset_filter)); + } + } + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - else + } else wrapper = CAMEL_DATA_WRAPPER (part); camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); camel_object_unref (CAMEL_OBJECT (filtered_stream)); -- cgit v1.2.3