From 8747a6919fbd4e318cceb8638f01d6f37e2d82f1 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 30 Oct 2003 05:03:28 +0000 Subject: show application/x-pkcs7-mime inline always by default. 2003-10-30 Not Zed * em-format.c (em_format_is_inline): show application/x-pkcs7-mime inline always by default. 2003-10-30 Not Zed * em-format.c (emf_multipart_signed): handle application/x-pkcs7-signature. 2003-10-29 Not Zed * em-format-html.c (em_format_html_multipart_signed_sign): handle application/x-pkcs7-signature. * em-format.c (emf_application_xpkcs7mime): Handle application/x-pkcs7-mime. svn path=/trunk/; revision=23129 --- mail/em-format-html.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'mail/em-format-html.c') diff --git a/mail/em-format-html.c b/mail/em-format-html.c index f95624e655..09f45d8ceb 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +62,7 @@ #include #include + #include #include "mail-component.h" @@ -913,29 +915,41 @@ em_format_html_multipart_signed_sign(EMFormat *emf, CamelStream *stream, CamelMi CamelException ex; const char *message = NULL; int good = 0; - CamelCipherContext *cipher; char *classid; EMFormatPURI *iconpuri; CamelMimePart *iconpart; static int iconid; mps = (CamelMultipartSigned *)camel_medium_get_content_object((CamelMedium *)part); + + /* FIXME: This sequence is also copied in em-format-html.c */ + spart = camel_multipart_get_part((CamelMultipart *)mps, CAMEL_MULTIPART_SIGNED_SIGNATURE); camel_exception_init(&ex); if (spart == NULL) { message = _("No signature present"); } else if (emf->session == NULL) { message = _("Session not initialised"); - } else if ((cipher = camel_gpg_context_new(emf->session)) == NULL) { - message = _("Could not create signature verfication context"); } else { - valid = camel_multipart_signed_verify(mps, cipher, &ex); - camel_object_unref(cipher); - if (valid) { - good = camel_cipher_validity_get_valid(valid)?1:0; - message = camel_cipher_validity_get_description(valid); + CamelCipherContext *cipher = NULL; + + /* FIXME: Should be done via a plugin interface */ + if (g_ascii_strcasecmp("application/x-pkcs7-signature", mps->protocol) == 0) + cipher = camel_smime_context_new(emf->session); + else if (g_ascii_strcasecmp("application/pgp-signature", mps->protocol) == 0) + cipher = camel_gpg_context_new(emf->session); + + if (cipher == NULL) { + message = _("Unsupported signature format"); } else { - message = camel_exception_get_description(&ex); + valid = camel_multipart_signed_verify(mps, cipher, &ex); + camel_object_unref(cipher); + if (valid) { + good = camel_cipher_validity_get_valid(valid)?1:0; + message = camel_cipher_validity_get_description(valid); + } else { + message = camel_exception_get_description(&ex); + } } } -- cgit v1.2.3