Re: notmuch-search-toggle-order and notmuch-tree
[notmuch-archives.git] / ca / 4145f75f5f1953337b775886a52f938f4f8b91
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 0F378429E25\r
6         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:57 -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 IavYEujHG-st for <notmuch@notmuchmail.org>;\r
16         Sat, 26 May 2012 11:45:55 -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 AC2C2431E62\r
20         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -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 7393E2E50C18\r
23         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
25 Received: from finestructure.net (unknown [76.89.192.57])\r
26         (Authenticated sender: jrollins)\r
27         by fire-doxen-submit (Postfix) with ESMTP id 234A12E50DB0\r
28         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:53 -0700 (PDT)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 72000B80; Sat, 26 May 2012 11:45:51 -0700 (PDT)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH v5 5/7] cli: modify mime_node_context to use the new crypto\r
34         struct\r
35 Date: Sat, 26 May 2012 11:45:44 -0700\r
36 Message-Id: <1338057946-29209-6-git-send-email-jrollins@finestructure.net>\r
37 X-Mailer: git-send-email 1.7.10\r
38 In-Reply-To: <1338057946-29209-5-git-send-email-jrollins@finestructure.net>\r
39 References: <1338057946-29209-1-git-send-email-jrollins@finestructure.net>\r
40         <1338057946-29209-2-git-send-email-jrollins@finestructure.net>\r
41         <1338057946-29209-3-git-send-email-jrollins@finestructure.net>\r
42         <1338057946-29209-4-git-send-email-jrollins@finestructure.net>\r
43         <1338057946-29209-5-git-send-email-jrollins@finestructure.net>\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Sat, 26 May 2012 18:45:57 -0000\r
57 \r
58 This simplifies some more interfaces.\r
59 ---\r
60  mime-node.c |   18 ++++++++----------\r
61  1 file changed, 8 insertions(+), 10 deletions(-)\r
62 \r
63 diff --git a/mime-node.c b/mime-node.c\r
64 index 67f4b16..a838224 100644\r
65 --- a/mime-node.c\r
66 +++ b/mime-node.c\r
67 @@ -33,8 +33,7 @@ typedef struct mime_node_context {\r
68      GMimeMessage *mime_message;\r
69  \r
70      /* Context provided by the caller. */\r
71 -    notmuch_crypto_context_t *cryptoctx;\r
72 -    notmuch_bool_t decrypt;\r
73 +    notmuch_crypto_t *crypto;\r
74  } mime_node_context_t;\r
75  \r
76  static int\r
77 @@ -109,8 +108,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
78         goto DONE;\r
79      }\r
80  \r
81 -    mctx->cryptoctx = crypto->gpgctx;\r
82 -    mctx->decrypt = crypto->decrypt;\r
83 +    mctx->crypto = crypto;\r
84  \r
85      /* Create the root node */\r
86      root->part = GMIME_OBJECT (mctx->mime_message);\r
87 @@ -186,7 +184,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
88  \r
89      /* Handle PGP/MIME parts */\r
90      if (GMIME_IS_MULTIPART_ENCRYPTED (part)\r
91 -       && node->ctx->cryptoctx && node->ctx->decrypt) {\r
92 +       && node->ctx->crypto->gpgctx && node->ctx->crypto->decrypt) {\r
93         if (node->nchildren != 2) {\r
94             /* this violates RFC 3156 section 4, so we won't bother with it. */\r
95             fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "\r
96 @@ -199,10 +197,10 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
97  #ifdef GMIME_ATLEAST_26\r
98             GMimeDecryptResult *decrypt_result = NULL;\r
99             node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
100 -               (encrypteddata, node->ctx->cryptoctx, &decrypt_result, &err);\r
101 +               (encrypteddata, node->ctx->crypto->gpgctx, &decrypt_result, &err);\r
102  #else\r
103             node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
104 -               (encrypteddata, node->ctx->cryptoctx, &err);\r
105 +               (encrypteddata, node->ctx->crypto->gpgctx, &err);\r
106  #endif\r
107             if (node->decrypted_child) {\r
108                 node->decrypt_success = node->verify_attempted = TRUE;\r
109 @@ -220,7 +218,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
110                          (err ? err->message : "no error explanation given"));\r
111             }\r
112         }\r
113 -    } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->cryptoctx) {\r
114 +    } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->gpgctx) {\r
115         if (node->nchildren != 2) {\r
116             /* this violates RFC 3156 section 5, so we won't bother with it. */\r
117             fprintf (stderr, "Error: %d part(s) for a multipart/signed message "\r
118 @@ -229,7 +227,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
119         } else {\r
120  #ifdef GMIME_ATLEAST_26\r
121             node->sig_list = g_mime_multipart_signed_verify\r
122 -               (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
123 +               (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);\r
124             node->verify_attempted = TRUE;\r
125  \r
126             if (!node->sig_list)\r
127 @@ -245,7 +243,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
128              * In GMime 2.6, they're both non-const, so we'll be able\r
129              * to clean up this asymmetry. */\r
130             GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify\r
131 -               (GMIME_MULTIPART_SIGNED (part), node->ctx->cryptoctx, &err);\r
132 +               (GMIME_MULTIPART_SIGNED (part), node->ctx->crypto->gpgctx, &err);\r
133             node->verify_attempted = TRUE;\r
134             node->sig_validity = sig_validity;\r
135             if (sig_validity) {\r
136 -- \r
137 1.7.10\r
138 \r