[PATCH v4 5/7] cli: modify mime_node_context to use the new crypto struct
authorJameson Graef Rollins <jrollins@finestructure.net>
Wed, 23 May 2012 22:40:41 +0000 (15:40 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:18 +0000 (09:47 -0800)
c3/8567a54f40d8cd9e55ec43421925c37fae8f46 [new file with mode: 0644]

diff --git a/c3/8567a54f40d8cd9e55ec43421925c37fae8f46 b/c3/8567a54f40d8cd9e55ec43421925c37fae8f46
new file mode 100644 (file)
index 0000000..d3bd726
--- /dev/null
@@ -0,0 +1,138 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id EBA77431FD5\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:52 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ppf6v7FiQA2E for <notmuch@notmuchmail.org>;\r
+       Wed, 23 May 2012 15:40:51 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id 6A712431FBD\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:50 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id 84FFE32805C\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:49 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [137.151.175.56])\r
+       (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id 9734A32807F\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:47 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 074711F2; Wed, 23 May 2012 15:40:46 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v4 5/7] cli: modify mime_node_context to use the new crypto\r
+       struct\r
+Date: Wed, 23 May 2012 15:40:41 -0700\r
+Message-Id: <1337812843-14986-6-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1337812843-14986-5-git-send-email-jrollins@finestructure.net>\r
+References: <1337812843-14986-1-git-send-email-jrollins@finestructure.net>\r
+       <1337812843-14986-2-git-send-email-jrollins@finestructure.net>\r
+       <1337812843-14986-3-git-send-email-jrollins@finestructure.net>\r
+       <1337812843-14986-4-git-send-email-jrollins@finestructure.net>\r
+       <1337812843-14986-5-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 23 May 2012 22:40:53 -0000\r
+\r
+This simplifies some more interfaces and gets rid of another #ifdef.\r
+---\r
+ mime-node.c |   18 ++++++++----------\r
+ 1 file changed, 8 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/mime-node.c b/mime-node.c\r
+index ba3a01b..a838224 100644\r
+--- a/mime-node.c\r
++++ b/mime-node.c\r
+@@ -33,8 +33,7 @@ typedef struct mime_node_context {\r
+     GMimeMessage *mime_message;\r
\r
+     /* Context provided by the caller. */\r
+-    GMimeCryptoContext *cryptoctx;\r
+-    notmuch_bool_t decrypt;\r
++    notmuch_crypto_t *crypto;\r
+ } mime_node_context_t;\r
\r
+ static int\r
+@@ -109,8 +108,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
+       goto DONE;\r
+     }\r
\r
+-    mctx->cryptoctx = crypto->gpgctx;\r
+-    mctx->decrypt = crypto->decrypt;\r
++    mctx->crypto = crypto;\r
\r
+     /* Create the root node */\r
+     root->part = GMIME_OBJECT (mctx->mime_message);\r
+@@ -186,7 +184,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
\r
+     /* Handle PGP/MIME parts */\r
+     if (GMIME_IS_MULTIPART_ENCRYPTED (part)\r
+-      && node->ctx->cryptoctx && node->ctx->decrypt) {\r
++      && node->ctx->crypto->gpgctx && node->ctx->crypto->decrypt) {\r
+       if (node->nchildren != 2) {\r
+           /* this violates RFC 3156 section 4, so we won't bother with it. */\r
+           fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "\r
+@@ -199,10 +197,10 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+ #ifdef GMIME_ATLEAST_26\r
+           GMimeDecryptResult *decrypt_result = NULL;\r
+           node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
+-              (encrypteddata, node->ctx->cryptoctx, &decrypt_result, &err);\r
++              (encrypteddata, node->ctx->crypto->gpgctx, &decrypt_result, &err);\r
+ #else\r
+           node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
+-              (encrypteddata, node->ctx->cryptoctx, &err);\r
++              (encrypteddata, node->ctx->crypto->gpgctx, &err);\r
+ #endif\r
+           if (node->decrypted_child) {\r
+               node->decrypt_success = node->verify_attempted = TRUE;\r
+@@ -220,7 +218,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+                        (err ? err->message : "no error explanation given"));\r
+           }\r
+       }\r
+-    } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->cryptoctx) {\r
++    } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->gpgctx) {\r
+       if (node->nchildren != 2) {\r
+           /* this violates RFC 3156 section 5, so we won't bother with it. */\r
+           fprintf (stderr, "Error: %d part(s) for a multipart/signed message "\r
+@@ -229,7 +227,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+       } else {\r
+ #ifdef GMIME_ATLEAST_26\r
+           node->sig_list = g_mime_multipart_signed_verify\r
+-              (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
++              (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);\r
+           node->verify_attempted = TRUE;\r
\r
+           if (!node->sig_list)\r
+@@ -245,7 +243,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+            * In GMime 2.6, they're both non-const, so we'll be able\r
+            * to clean up this asymmetry. */\r
+           GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify\r
+-              (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
++              (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);\r
+           node->verify_attempted = TRUE;\r
+           node->sig_validity = sig_validity;\r
+           if (sig_validity) {\r
+-- \r
+1.7.10\r
+\r