1 Return-Path: <jrollins@finestructure.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 0B773431FBC
\r
6 for <notmuch@notmuchmail.org>; Fri, 18 May 2012 10:32:51 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id yx-xTarr8auM for <notmuch@notmuchmail.org>;
\r
16 Fri, 18 May 2012 10:32:49 -0700 (PDT)
\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id B7FED431FC0
\r
20 for <notmuch@notmuchmail.org>; Fri, 18 May 2012 10:32:46 -0700 (PDT)
\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
22 by fire-doxen-postvirus (Postfix) with ESMTP id 492D1328090
\r
23 for <notmuch@notmuchmail.org>; Fri, 18 May 2012 10:32:44 -0700 (PDT)
\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
25 Received: from finestructure.net (cpe-98-14-81-93.nyc.res.rr.com
\r
26 [98.14.81.93]) (Authenticated sender: jrollins) by fire-doxen-submit
\r
27 (Postfix) with ESMTP id DF6ED32807A for <notmuch@notmuchmail.org>; Fri, 18
\r
28 May 2012 10:32:41 -0700 (PDT)
\r
29 Received: by finestructure.net (Postfix, from userid 1000)
\r
30 id 45C7F61B; Fri, 18 May 2012 10:32:40 -0700 (PDT)
\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
33 Subject: [PATCH v2 3/5] cli: modify mime_node_context to use the new
\r
35 Date: Fri, 18 May 2012 10:32:35 -0700
\r
36 Message-Id: <1337362357-31281-4-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.10
\r
38 In-Reply-To: <1337362357-31281-3-git-send-email-jrollins@finestructure.net>
\r
39 References: <1337362357-31281-1-git-send-email-jrollins@finestructure.net>
\r
40 <1337362357-31281-2-git-send-email-jrollins@finestructure.net>
\r
41 <1337362357-31281-3-git-send-email-jrollins@finestructure.net>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Fri, 18 May 2012 17:32:51 -0000
\r
56 This simplifies some more interfaces and gets rid of another #ifdef.
\r
58 mime-node.c | 22 ++++++++--------------
\r
59 1 file changed, 8 insertions(+), 14 deletions(-)
\r
61 diff --git a/mime-node.c b/mime-node.c
\r
62 index 183ff5d..3dda900 100644
\r
65 @@ -33,12 +33,7 @@ typedef struct mime_node_context {
\r
66 GMimeMessage *mime_message;
\r
68 /* Context provided by the caller. */
\r
69 -#ifdef GMIME_ATLEAST_26
\r
70 - GMimeCryptoContext *cryptoctx;
\r
72 - GMimeCipherContext *cryptoctx;
\r
74 - notmuch_bool_t decrypt;
\r
75 + notmuch_crypto_t *crypto;
\r
76 } mime_node_context_t;
\r
79 @@ -113,8 +108,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
\r
83 - mctx->cryptoctx = crypto->gpgctx;
\r
84 - mctx->decrypt = crypto->decrypt;
\r
85 + mctx->crypto = crypto;
\r
87 /* Create the root node */
\r
88 root->part = GMIME_OBJECT (mctx->mime_message);
\r
89 @@ -190,7 +184,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
91 /* Handle PGP/MIME parts */
\r
92 if (GMIME_IS_MULTIPART_ENCRYPTED (part)
\r
93 - && node->ctx->cryptoctx && node->ctx->decrypt) {
\r
94 + && node->ctx->crypto->gpgctx && node->ctx->crypto->decrypt) {
\r
95 if (node->nchildren != 2) {
\r
96 /* this violates RFC 3156 section 4, so we won't bother with it. */
\r
97 fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "
\r
98 @@ -203,10 +197,10 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
99 #ifdef GMIME_ATLEAST_26
\r
100 GMimeDecryptResult *decrypt_result = NULL;
\r
101 node->decrypted_child = g_mime_multipart_encrypted_decrypt
\r
102 - (encrypteddata, node->ctx->cryptoctx, &decrypt_result, &err);
\r
103 + (encrypteddata, node->ctx->crypto->gpgctx, &decrypt_result, &err);
\r
105 node->decrypted_child = g_mime_multipart_encrypted_decrypt
\r
106 - (encrypteddata, node->ctx->cryptoctx, &err);
\r
107 + (encrypteddata, node->ctx->crypto->gpgctx, &err);
\r
109 if (node->decrypted_child) {
\r
110 node->decrypt_success = node->verify_attempted = TRUE;
\r
111 @@ -224,7 +218,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
112 (err ? err->message : "no error explanation given"));
\r
115 - } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->cryptoctx) {
\r
116 + } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->gpgctx) {
\r
117 if (node->nchildren != 2) {
\r
118 /* this violates RFC 3156 section 5, so we won't bother with it. */
\r
119 fprintf (stderr, "Error: %d part(s) for a multipart/signed message "
\r
120 @@ -233,7 +227,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
122 #ifdef GMIME_ATLEAST_26
\r
123 node->sig_list = g_mime_multipart_signed_verify
\r
124 - (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);
\r
125 + (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);
\r
126 node->verify_attempted = TRUE;
\r
128 if (!node->sig_list)
\r
129 @@ -249,7 +243,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
130 * In GMime 2.6, they're both non-const, so we'll be able
\r
131 * to clean up this asymmetry. */
\r
132 GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify
\r
133 - (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);
\r
134 + (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto.gpgctx, &err);
\r
135 node->verify_attempted = TRUE;
\r
136 node->sig_validity = sig_validity;
\r
137 if (sig_validity) {
\r