summaryrefslogtreecommitdiffstats
path: root/mailnews/mime/src/mimemsig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/mime/src/mimemsig.cpp')
-rw-r--r--mailnews/mime/src/mimemsig.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/mailnews/mime/src/mimemsig.cpp b/mailnews/mime/src/mimemsig.cpp
index d74cfb09a..bb34607cb 100644
--- a/mailnews/mime/src/mimemsig.cpp
+++ b/mailnews/mime/src/mimemsig.cpp
@@ -14,6 +14,7 @@
#include "msgCore.h"
#include "nsMimeStringResources.h"
#include "mimemoz2.h"
+#include "mimeeobj.h"
#include "nsIMimeConverter.h" // for MimeConverterOutputCallback
#include "mozilla/Attributes.h"
@@ -32,6 +33,8 @@ static void MimeMultipartSigned_finalize (MimeObject *);
static int MimeMultipartSigned_emit_child (MimeObject *obj);
+extern "C" MimeSuppressedCryptoClass mimeSuppressedCryptoClass;
+
static int
MimeMultipartSignedClassInitialize(MimeMultipartSignedClass *clazz)
{
@@ -582,6 +585,11 @@ MimeMultipartSigned_emit_child (MimeObject *obj)
int status = 0;
MimeObject *body;
+ if (!sig->crypto_closure) {
+ // We might have decided to skip processing this part.
+ return 0;
+ }
+
NS_ASSERTION(sig->crypto_closure, "no crypto closure");
/* Emit some HTML saying whether the signature was cool.
@@ -594,15 +602,11 @@ MimeMultipartSigned_emit_child (MimeObject *obj)
obj->options->headers != MimeHeadersCitation &&
sig->crypto_closure)
{
+ // Calling crypto_generate_html may trigger wanted side effects,
+ // but we're no longer using its results.
char *html = (((MimeMultipartSignedClass *) obj->clazz)
->crypto_generate_html (sig->crypto_closure));
-#if 0 // XXX For the moment, no HTML output. Fix this XXX //
- if (!html) return -1; /* MIME_OUT_OF_MEMORY? */
-
- status = MimeObject_write(obj, html, strlen(html), false);
- PR_Free(html);
- if (status < 0) return status;
-#endif
+ PR_FREEIF(html);
/* Now that we have written out the crypto stamp, the outermost header
block is well and truly closed. If this is in fact the outermost
@@ -719,6 +723,11 @@ MimeMultipartSigned_emit_child (MimeObject *obj)
if (!body)
return -1;
+ if (mime_typep(body, (MimeObjectClass *)&mimeSuppressedCryptoClass)) {
+ ((MimeMultipartSignedClass *)obj->clazz)
+ ->crypto_notify_suppressed_child(sig->crypto_closure);
+ }
+
#ifdef MIME_DRAFTS
if (body->options->decompose_file_p) {
body->options->signed_p = true;