aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-smime-context.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@src.gnome.org>2001-08-30 05:29:52 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-30 05:29:52 +0800
commita036c22b744939540ce776e76826f215cf7d81a2 (patch)
tree18e4f90d1cf20d4a9b1433c909d1b903d39be650 /camel/camel-smime-context.c
parent4572ee60ec1d8e854fc76fa09f1d670db3e896b7 (diff)
downloadgsoc2013-evolution-a036c22b744939540ce776e76826f215cf7d81a2.tar.gz
gsoc2013-evolution-a036c22b744939540ce776e76826f215cf7d81a2.tar.zst
gsoc2013-evolution-a036c22b744939540ce776e76826f215cf7d81a2.zip
fix smime the same way...
svn path=/trunk/; revision=12520
Diffstat (limited to 'camel/camel-smime-context.c')
-rw-r--r--camel/camel-smime-context.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c
index 8f944841fe..46ecf5c3a7 100644
--- a/camel/camel-smime-context.c
+++ b/camel/camel-smime-context.c
@@ -272,7 +272,7 @@ signed_data (CamelSMimeContext *ctx, const char *userid, gboolean signing_time,
}
static void
-smime_sign_restore (CamelMimePart *mime_part, GSList *encodings)
+smime_sign_restore (CamelMimePart *mime_part, GSList **encodings)
{
CamelDataWrapper *wrapper;
@@ -288,14 +288,19 @@ smime_sign_restore (CamelMimePart *mime_part, GSList *encodings)
CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (wrapper), i);
smime_sign_restore (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 */
+ smime_sign_restore (CAMEL_MIME_PART (wrapper), encodings);
+ } else {
+ encoding = GPOINTER_TO_INT ((*encodings)->data);
+
+ camel_mime_part_set_encoding (mime_part, encoding);
+ }
}
}
@@ -319,14 +324,19 @@ smime_sign_prepare (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 */
+ smime_sign_prepare (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));
+ }
}
}
@@ -343,7 +353,7 @@ smime_sign (CamelCMSContext *ctx, CamelMimeMessage *message,
NSSCMSEncoderContext *ecx;
SECItem output = { 0, 0, 0 };
CamelStream *stream;
- GSList *encodings = NULL;
+ GSList *list, *encodings = NULL;
GByteArray *buf;
cmsg = signed_data (CAMEL_SMIME_CONTEXT (ctx), userid, signing_time, detached, ex);
@@ -363,7 +373,8 @@ smime_sign (CamelCMSContext *ctx, CamelMimeMessage *message,
smime_sign_prepare (CAMEL_MIME_PART (message), &encodings);
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
- smime_sign_restore (CAMEL_MIME_PART (message), encodings);
+ list = encodings;
+ smime_sign_restore (CAMEL_MIME_PART (message), &list);
g_slist_free (encodings);
buf = CAMEL_STREAM_MEM (stream)->buffer;