diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-30 05:23:03 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-30 05:23:03 +0800 |
commit | 4572ee60ec1d8e854fc76fa09f1d670db3e896b7 (patch) | |
tree | 81e7697b8a29d09b5398e1bb318592c742092fa8 /camel/camel-pgp-mime.c | |
parent | 8c22a4d62ecd7f626aad583192e361e3658c72ee (diff) | |
download | gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.tar gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.tar.gz gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.tar.bz2 gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.tar.lz gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.tar.xz gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.tar.zst gsoc2013-evolution-4572ee60ec1d8e854fc76fa09f1d670db3e896b7.zip |
Special-case message/rfc822 mime parts - don't set an encoding on these,
2001-08-29 Jeffrey Stedfast <fejj@ximian.com>
* camel-pgp-mime.c (pgp_mime_part_sign_prepare_part): Special-case
message/rfc822 mime parts - don't set an encoding on these,
instead traverse into their subparts and set the encodings for
those.
(pgp_mime_part_sign_restore_part): Reverse any operations done to
message/rfc822 parts in the above prepare_part() function and also
take a pointer to a GSList of encodings instead of just a GSList
so we can properly keep track of which encoding we are on.
svn path=/trunk/; revision=12519
Diffstat (limited to 'camel/camel-pgp-mime.c')
-rw-r--r-- | camel/camel-pgp-mime.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c index ce8071cbc2..0a852fe244 100644 --- a/camel/camel-pgp-mime.c +++ b/camel/camel-pgp-mime.c @@ -26,6 +26,7 @@ #endif #include "camel-pgp-mime.h" +#include "camel-mime-message.h" #include "camel-mime-filter-from.h" #include "camel-mime-filter-crlf.h" #include "camel-stream-filter.h" @@ -132,7 +133,7 @@ camel_pgp_mime_is_rfc2015_encrypted (CamelMimePart *mime_part) static void -pgp_mime_part_sign_restore_part (CamelMimePart *mime_part, GSList *encodings) +pgp_mime_part_sign_restore_part (CamelMimePart *mime_part, GSList **encodings) { CamelDataWrapper *wrapper; @@ -148,14 +149,19 @@ pgp_mime_part_sign_restore_part (CamelMimePart *mime_part, GSList *encodings) CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (wrapper), i); pgp_mime_part_sign_restore_part (part, encodings); - encodings = encodings->next; + *encodings = (*encodings)->next; } } else { CamelMimePartEncodingType encoding; - encoding = GPOINTER_TO_INT (encodings->data); - - camel_mime_part_set_encoding (mime_part, encoding); + if (CAMEL_IS_MIME_MESSAGE (wrapper)) { + /* restore the message parts' subparts */ + pgp_mime_part_sign_restore_part (CAMEL_MIME_PART (wrapper), encodings); + } else { + encoding = GPOINTER_TO_INT ((*encodings)->data); + + camel_mime_part_set_encoding (mime_part, encoding); + } } } @@ -179,14 +185,19 @@ pgp_mime_part_sign_prepare_part (CamelMimePart *mime_part, GSList **encodings) } else { CamelMimePartEncodingType encoding; - encoding = camel_mime_part_get_encoding (mime_part); - - /* FIXME: find the best encoding for this part and use that instead?? */ - /* the encoding should really be QP or Base64 */ - if (encoding != CAMEL_MIME_PART_ENCODING_BASE64) - camel_mime_part_set_encoding (mime_part, CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE); - - *encodings = g_slist_append (*encodings, GINT_TO_POINTER (encoding)); + if (CAMEL_IS_MIME_MESSAGE (wrapper)) { + /* prepare the message parts' subparts */ + pgp_mime_part_sign_prepare_part (CAMEL_MIME_PART (wrapper), encodings); + } else { + encoding = camel_mime_part_get_encoding (mime_part); + + /* FIXME: find the best encoding for this part and use that instead?? */ + /* the encoding should really be QP or Base64 */ + if (encoding != CAMEL_MIME_PART_ENCODING_BASE64) + camel_mime_part_set_encoding (mime_part, CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE); + + *encodings = g_slist_append (*encodings, GINT_TO_POINTER (encoding)); + } } } @@ -260,11 +271,14 @@ camel_pgp_mime_part_sign (CamelPgpContext *context, CamelMimePart **mime_part, c /* get the signature */ if (camel_pgp_sign (context, userid, hash, stream, sigstream, ex) == -1) { + GSList *list; + camel_object_unref (CAMEL_OBJECT (stream)); camel_object_unref (CAMEL_OBJECT (sigstream)); /* restore the original encoding */ - pgp_mime_part_sign_restore_part (part, encodings); + list = encodings; + pgp_mime_part_sign_restore_part (part, &list); g_slist_free (encodings); return; } |