Re: [PATCH v4 08/16] reorganize indexing of multipart/signed and multipart/encrypted
[notmuch-archives.git] / 5d / 22c606113ab788ceb2fe3eac0ba49dc8496532
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 C78EC429E56\r
6         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:59 -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 82uAvoSDAdXM for <notmuch@notmuchmail.org>;\r
16         Sat, 26 May 2012 11:45:57 -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 E63A9429E28\r
20         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by earth-doxen-postvirus (Postfix) with ESMTP id D055C66E001B\r
23         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:53 -0700 (PDT)\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
25 Received: from finestructure.net (unknown [76.89.192.57])\r
26         (Authenticated sender: jrollins)\r
27         by earth-doxen-submit (Postfix) with ESMTP id CD59C66E00C0\r
28         for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:51 -0700 (PDT)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 6F71BB69; 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 4/7] cli: modify mime_node_open to take new crypto struct\r
34         as argument\r
35 Date: Sat, 26 May 2012 11:45:43 -0700\r
36 Message-Id: <1338057946-29209-5-git-send-email-jrollins@finestructure.net>\r
37 X-Mailer: git-send-email 1.7.10\r
38 In-Reply-To: <1338057946-29209-4-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 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Sat, 26 May 2012 18:46:00 -0000\r
56 \r
57 This simplifies the interface considerably.\r
58 ---\r
59  mime-node.c      |    7 +++----\r
60  notmuch-client.h |   10 +++++-----\r
61  notmuch-reply.c  |    6 ++----\r
62  notmuch-show.c   |    3 +--\r
63  4 files changed, 11 insertions(+), 15 deletions(-)\r
64 \r
65 diff --git a/mime-node.c b/mime-node.c\r
66 index a5645e5..67f4b16 100644\r
67 --- a/mime-node.c\r
68 +++ b/mime-node.c\r
69 @@ -57,8 +57,7 @@ _mime_node_context_free (mime_node_context_t *res)\r
70  \r
71  notmuch_status_t\r
72  mime_node_open (const void *ctx, notmuch_message_t *message,\r
73 -               notmuch_crypto_context_t *cryptoctx,\r
74 -               notmuch_bool_t decrypt, mime_node_t **root_out)\r
75 +               notmuch_crypto_t *crypto, mime_node_t **root_out)\r
76  {\r
77      const char *filename = notmuch_message_get_filename (message);\r
78      mime_node_context_t *mctx;\r
79 @@ -110,8 +109,8 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
80         goto DONE;\r
81      }\r
82  \r
83 -    mctx->cryptoctx = cryptoctx;\r
84 -    mctx->decrypt = decrypt;\r
85 +    mctx->cryptoctx = crypto->gpgctx;\r
86 +    mctx->decrypt = crypto->decrypt;\r
87  \r
88      /* Create the root node */\r
89      root->part = GMIME_OBJECT (mctx->mime_message);\r
90 diff --git a/notmuch-client.h b/notmuch-client.h\r
91 index ead7fbd..962c747 100644\r
92 --- a/notmuch-client.h\r
93 +++ b/notmuch-client.h\r
94 @@ -350,9 +350,10 @@ struct mime_node {\r
95  };\r
96  \r
97  /* Construct a new MIME node pointing to the root message part of\r
98 - * message.  If cryptoctx is non-NULL, it will be used to verify\r
99 - * signatures on any child parts.  If decrypt is true, then cryptoctx\r
100 - * will additionally be used to decrypt any encrypted child parts.\r
101 + * message.  If crypto->gpgctx is non-NULL, it will be used to verify\r
102 + * signatures on any child parts.  If crypto->decrypt is true, then\r
103 + * crypto.gpgctx will additionally be used to decrypt any encrypted\r
104 + * child parts.\r
105   *\r
106   * Return value:\r
107   *\r
108 @@ -364,8 +365,7 @@ struct mime_node {\r
109   */\r
110  notmuch_status_t\r
111  mime_node_open (const void *ctx, notmuch_message_t *message,\r
112 -               notmuch_crypto_context_t *cryptoctx,\r
113 -               notmuch_bool_t decrypt, mime_node_t **node_out);\r
114 +               notmuch_crypto_t *crypto, mime_node_t **node_out);\r
115  \r
116  /* Return a new MIME node for the requested child part of parent.\r
117   * parent will be used as the talloc context for the returned child\r
118 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
119 index 11f269f..6f368c9 100644\r
120 --- a/notmuch-reply.c\r
121 +++ b/notmuch-reply.c\r
122 @@ -575,8 +575,7 @@ notmuch_reply_format_default(void *ctx,\r
123         g_object_unref (G_OBJECT (reply));\r
124         reply = NULL;\r
125  \r
126 -       if (mime_node_open (ctx, message, params->crypto.gpgctx, params->crypto.decrypt,\r
127 -                           &root) == NOTMUCH_STATUS_SUCCESS) {\r
128 +       if (mime_node_open (ctx, message, &(params->crypto), &root) == NOTMUCH_STATUS_SUCCESS) {\r
129             format_part_reply (root);\r
130             talloc_free (root);\r
131         }\r
132 @@ -605,8 +604,7 @@ notmuch_reply_format_json(void *ctx,\r
133  \r
134      messages = notmuch_query_search_messages (query);\r
135      message = notmuch_messages_get (messages);\r
136 -    if (mime_node_open (ctx, message, params->crypto.gpgctx, params->crypto.decrypt,\r
137 -                       &node) != NOTMUCH_STATUS_SUCCESS)\r
138 +    if (mime_node_open (ctx, message, &(params->crypto), &node) != NOTMUCH_STATUS_SUCCESS)\r
139         return 1;\r
140  \r
141      reply = create_reply_message (ctx, config, message, reply_all);\r
142 diff --git a/notmuch-show.c b/notmuch-show.c\r
143 index cc509a6..fb5e9b6 100644\r
144 --- a/notmuch-show.c\r
145 +++ b/notmuch-show.c\r
146 @@ -810,8 +810,7 @@ show_message (void *ctx,\r
147      mime_node_t *root, *part;\r
148      notmuch_status_t status;\r
149  \r
150 -    status = mime_node_open (local, message, params->crypto.gpgctx,\r
151 -                            params->crypto.decrypt, &root);\r
152 +    status = mime_node_open (local, message, &(params->crypto), &root);\r
153      if (status)\r
154         goto DONE;\r
155      part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));\r
156 -- \r
157 1.7.10\r
158 \r