[PATCH 6/8] CLI: refactor dumping of tags.
[notmuch-archives.git] / ec / a9c5c9f240c62724653d711d9262218f02c717
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 0999F431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 16 May 2012 14:56:13 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \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 wZOFzPRf6G2n for <notmuch@notmuchmail.org>;\r
16         Wed, 16 May 2012 14:56:11 -0700 (PDT)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 0C605431FBD\r
20         for <notmuch@notmuchmail.org>; Wed, 16 May 2012 14:56:10 -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 34B3D2E50378\r
23         for <notmuch@notmuchmail.org>; Wed, 16 May 2012 14:56:06 -0700 (PDT)\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
25 Received: from finestructure.net (rrcs-184-74-199-219.nyc.biz.rr.com\r
26         [184.74.199.219]) (Authenticated sender: jrollins)\r
27         by fire-doxen-submit (Postfix) with ESMTP id 0EF8F32801D\r
28         for <notmuch@notmuchmail.org>; Wed, 16 May 2012 14:56:04 -0700 (PDT)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 1810A5D4; Wed, 16 May 2012 14:56:02 -0700 (PDT)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH 2/6] cli: modify mime_node_context to use the new\r
34         notmuch_crypto_t\r
35 Date: Wed, 16 May 2012 14:55:55 -0700\r
36 Message-Id: <1337205359-2444-3-git-send-email-jrollins@finestructure.net>\r
37 X-Mailer: git-send-email 1.7.10\r
38 In-Reply-To: <1337205359-2444-2-git-send-email-jrollins@finestructure.net>\r
39 References: <1337205359-2444-1-git-send-email-jrollins@finestructure.net>\r
40         <1337205359-2444-2-git-send-email-jrollins@finestructure.net>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Wed, 16 May 2012 21:56:13 -0000\r
54 \r
55 This simplifies some more interfaces and gets rid of another #ifdef.\r
56 ---\r
57  mime-node.c |   23 +++++++++--------------\r
58  1 file changed, 9 insertions(+), 14 deletions(-)\r
59 \r
60 diff --git a/mime-node.c b/mime-node.c\r
61 index a95bdab..79a3654 100644\r
62 --- a/mime-node.c\r
63 +++ b/mime-node.c\r
64 @@ -33,12 +33,7 @@ typedef struct mime_node_context {\r
65      GMimeMessage *mime_message;\r
66  \r
67      /* Context provided by the caller. */\r
68 -#ifdef GMIME_ATLEAST_26\r
69 -    GMimeCryptoContext *cryptoctx;\r
70 -#else\r
71 -    GMimeCipherContext *cryptoctx;\r
72 -#endif\r
73 -    notmuch_bool_t decrypt;\r
74 +    notmuch_crypto_t crypto;\r
75  } mime_node_context_t;\r
76  \r
77  static int\r
78 @@ -118,8 +113,8 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
79         goto DONE;\r
80      }\r
81  \r
82 -    mctx->cryptoctx = cryptoctx;\r
83 -    mctx->decrypt = decrypt;\r
84 +    mctx->crypto.gpgctx = cryptoctx;\r
85 +    mctx->crypto.decrypt = decrypt;\r
86  \r
87      /* Create the root node */\r
88      root->part = GMIME_OBJECT (mctx->mime_message);\r
89 @@ -195,7 +190,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
90  \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 @@ -208,10 +203,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
104  #else\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
108  #endif\r
109             if (node->decrypted_child) {\r
110                 node->decrypt_success = node->verify_attempted = TRUE;\r
111 @@ -229,7 +224,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
112                          (err ? err->message : "no error explanation given"));\r
113             }\r
114         }\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 @@ -238,7 +233,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
121         } else {\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
127  \r
128             if (!node->sig_list)\r
129 @@ -254,7 +249,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
138 -- \r
139 1.7.10\r
140 \r