diff options
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_0_2
'EVOLUTION_1_0_2'.
svn path=/tags/EVOLUTION_1_0_2/; revision=15455
Diffstat (limited to 'camel/camel-pgp-mime.c')
-rw-r--r-- | camel/camel-pgp-mime.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c index 4afa137aec..f90e67f8d0 100644 --- a/camel/camel-pgp-mime.c +++ b/camel/camel-pgp-mime.c @@ -376,7 +376,30 @@ camel_pgp_mime_part_verify (CamelPgpContext *context, CamelMimePart *mime_part, camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (from_filter)); camel_object_unref (CAMEL_OBJECT (from_filter)); - wrapper = CAMEL_DATA_WRAPPER (part); + type = camel_mime_part_get_content_type (mime_part); + 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 + wrapper = CAMEL_DATA_WRAPPER (part); camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); camel_object_unref (CAMEL_OBJECT (filtered_stream)); camel_stream_reset (stream); @@ -459,6 +482,7 @@ camel_pgp_mime_part_encrypt (CamelPgpContext *context, CamelMimePart **mime_part camel_mime_part_set_content (encrypted_part, CAMEL_STREAM_MEM (ciphertext)->buffer->data, CAMEL_STREAM_MEM (ciphertext)->buffer->len, "application/octet-stream; name=encrypted.asc"); + camel_mime_part_set_description (encrypted_part, _("This is an encrypted message part")); camel_object_unref (CAMEL_OBJECT (ciphertext)); camel_mime_part_set_encoding (encrypted_part, CAMEL_MIME_PART_ENCODING_7BIT); @@ -538,6 +562,27 @@ camel_pgp_mime_part_decrypt (CamelPgpContext *context, CamelMimePart *mime_part, camel_object_unref (CAMEL_OBJECT (ciphertext)); camel_stream_reset (stream); + mime_type = camel_mime_part_get_content_type (mime_part); + if (header_content_type_param (mime_type, "x-inline-pgp-hack")) { + /* this is a kludge around inline pgp encryption - basically, + the multipart/encrypted is fake - the original encrypted + content is not really an encrypted mime part so after + decrypting it, we have to fake some mime content headers */ + CamelStream *hack; + + hack = camel_stream_mem_new (); + +#define CONTENT_TYPE_TEXT_PLAIN "Content-Type: text/plain\r\n\r\n" + camel_stream_write (hack, CONTENT_TYPE_TEXT_PLAIN, + sizeof (CONTENT_TYPE_TEXT_PLAIN) - 1); + + camel_stream_write_to_stream (stream, hack); + camel_stream_reset (hack); + + camel_object_unref (CAMEL_OBJECT (stream)); + stream = hack; + } + /* construct the new decrypted mime part from the stream */ part = camel_mime_part_new (); |