1 Return-Path: <dkg@fifthhorseman.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 arlo.cworth.org (Postfix) with ESMTP id 166646DE1B85
\r
6 for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.023 tagged_above=-999 required=5
\r
12 tests=[AWL=-0.023] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Cfh9usCn4Lx1 for <notmuch@notmuchmail.org>;
\r
16 Tue, 19 Jan 2016 18:53:25 -0800 (PST)
\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id 6E68C6DE163B
\r
19 for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:16 -0800 (PST)
\r
20 Received: from fifthhorseman.net (unknown [38.109.115.130])
\r
21 by che.mayfirst.org (Postfix) with ESMTPSA id CE3F6F993
\r
22 for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 21:53:13 -0500 (EST)
\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)
\r
24 id E46D420257; Tue, 19 Jan 2016 18:53:10 -0800 (PST)
\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
27 Subject: [PATCH v2 07/16] create a notmuch_indexopts_t index options object
\r
28 Date: Tue, 19 Jan 2016 21:52:40 -0500
\r
29 Message-Id: <1453258369-7366-8-git-send-email-dkg@fifthhorseman.net>
\r
30 X-Mailer: git-send-email 2.7.0.rc3
\r
31 In-Reply-To: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>
\r
32 References: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>
\r
34 Content-Type: text/plain; charset=UTF-8
\r
35 Content-Transfer-Encoding: 8bit
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.20
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Wed, 20 Jan 2016 02:53:28 -0000
\r
50 This is currently mostly a wrapper around _notmuch_crypto_t that keeps
\r
51 its internals private and doesn't expose any of the GMime API.
\r
52 However, non-crypto indexing options might also be added later to
\r
53 indexopts (e.g. filters or other transformations).
\r
55 lib/Makefile.local | 1 +
\r
56 lib/indexopts.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
\r
57 lib/notmuch-private.h | 7 +++++
\r
58 lib/notmuch.h | 63 ++++++++++++++++++++++++++++++++++++++++++++
\r
59 4 files changed, 143 insertions(+)
\r
60 create mode 100644 lib/indexopts.c
\r
62 diff --git a/lib/Makefile.local b/lib/Makefile.local
\r
63 index 3a07090..1652b1b 100644
\r
64 --- a/lib/Makefile.local
\r
65 +++ b/lib/Makefile.local
\r
66 @@ -39,6 +39,7 @@ libnotmuch_c_srcs = \
\r
67 $(dir)/message-file.c \
\r
70 + $(dir)/indexopts.c \
\r
73 libnotmuch_cxx_srcs = \
\r
74 diff --git a/lib/indexopts.c b/lib/indexopts.c
\r
75 new file mode 100644
\r
76 index 0000000..da36e2b
\r
78 +++ b/lib/indexopts.c
\r
80 +/* indexopts.c - options for indexing messages
\r
82 + * Copyright © 2015 Daniel Kahn Gillmor
\r
84 + * This program is free software: you can redistribute it and/or modify
\r
85 + * it under the terms of the GNU General Public License as published by
\r
86 + * the Free Software Foundation, either version 3 of the License, or
\r
87 + * (at your option) any later version.
\r
89 + * This program is distributed in the hope that it will be useful,
\r
90 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
91 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
92 + * GNU General Public License for more details.
\r
94 + * You should have received a copy of the GNU General Public License
\r
95 + * along with this program. If not, see http://www.gnu.org/licenses/ .
\r
97 + * Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
\r
100 +#include "notmuch-private.h"
\r
102 +notmuch_indexopts_t *
\r
103 +notmuch_indexopts_create ()
\r
105 + notmuch_indexopts_t *ret;
\r
107 + ret = talloc_zero (NULL, notmuch_indexopts_t);
\r
113 +notmuch_indexopts_set_try_decrypt (notmuch_indexopts_t *indexopts,
\r
114 + notmuch_bool_t try_decrypt)
\r
117 + return NOTMUCH_STATUS_NULL_POINTER;
\r
118 + indexopts->crypto.decrypt = try_decrypt;
\r
119 + return NOTMUCH_STATUS_SUCCESS;
\r
123 +notmuch_indexopts_get_try_decrypt (const notmuch_indexopts_t *indexopts)
\r
127 + return indexopts->crypto.decrypt;
\r
131 +notmuch_indexopts_set_gpg_path (notmuch_indexopts_t *indexopts,
\r
132 + const char *gpg_path)
\r
135 + return NOTMUCH_STATUS_NULL_POINTER;
\r
136 + return _notmuch_crypto_set_gpg_path (&(indexopts->crypto), gpg_path);
\r
140 +notmuch_indexopts_get_gpg_path (const notmuch_indexopts_t *indexopts)
\r
144 + return _notmuch_crypto_get_gpg_path (&(indexopts->crypto));
\r
148 +notmuch_indexopts_destroy (notmuch_indexopts_t *indexopts)
\r
150 + talloc_free (indexopts);
\r
152 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
153 index 5dd4770..e9c1e8a 100644
\r
154 --- a/lib/notmuch-private.h
\r
155 +++ b/lib/notmuch-private.h
\r
156 @@ -51,6 +51,7 @@ NOTMUCH_BEGIN_DECLS
\r
158 #include "error_util.h"
\r
159 #include "string-util.h"
\r
160 +#include "crypto.h"
\r
162 #pragma GCC visibility push(hidden)
\r
164 @@ -544,6 +545,12 @@ _notmuch_thread_create (void *ctx,
\r
165 notmuch_exclude_t omit_exclude,
\r
166 notmuch_sort_t sort);
\r
170 +typedef struct _notmuch_indexopts {
\r
171 + _notmuch_crypto_t crypto;
\r
172 +} notmuch_indexopts_t;
\r
177 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
178 index 00002f1..3679c54 100644
\r
179 --- a/lib/notmuch.h
\r
180 +++ b/lib/notmuch.h
\r
181 @@ -214,6 +214,7 @@ typedef struct _notmuch_message notmuch_message_t;
\r
182 typedef struct _notmuch_tags notmuch_tags_t;
\r
183 typedef struct _notmuch_directory notmuch_directory_t;
\r
184 typedef struct _notmuch_filenames notmuch_filenames_t;
\r
185 +typedef struct _notmuch_indexopts notmuch_indexopts_t;
\r
186 #endif /* __DOXYGEN__ */
\r
189 @@ -1846,6 +1847,68 @@ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);
\r
191 notmuch_filenames_destroy (notmuch_filenames_t *filenames);
\r
194 + * Create a notmuch_indexopts_t object.
\r
196 + * This object describes options on how indexing can happen when a
\r
197 + * message is added to the index.
\r
199 +notmuch_indexopts_t *
\r
200 +notmuch_indexopts_create ();
\r
203 + * Specify whether to decrypt encrypted parts while indexing.
\r
205 + * Be aware that the index is likely sufficient to reconstruct the
\r
206 + * cleartext of the message itself, so please ensure that the notmuch
\r
207 + * message index is adequately protected. DO NOT SET THIS FLAG TO TRUE
\r
208 + * without considering the security of your index.
\r
212 +notmuch_indexopts_set_try_decrypt (notmuch_indexopts_t *indexopts,
\r
213 + notmuch_bool_t try_decrypt);
\r
216 + * Return whether to decrypt encrypted parts while indexing.
\r
217 + * see notmuch_indexopts_set_try_decrypt.
\r
220 +notmuch_indexopts_get_try_decrypt (const notmuch_indexopts_t *indexopts);
\r
223 + * Specify the name (or name and path) of the gpg executable, in case
\r
224 + * GnuPG needs to be used during indexing. The default should usually
\r
227 + * Passing NULL to this will reset it to the default.
\r
231 + * NOTMUCH_STATUS_SUCCESS: the path was accepted and will be used.
\r
233 + * NOTMUCH_STATUS_FILE_ERROR: the path given either wasn't found or
\r
234 + * wasn't executable.
\r
237 +notmuch_indexopts_set_gpg_path (notmuch_indexopts_t *indexopts,
\r
238 + const char *gpg_path);
\r
241 + * Return the name (possibly including path) of the gpg executable to
\r
242 + * be used in case GnuPG needs to be used during indexing.
\r
244 + * see notmuch_indexopts_set_gpg_path
\r
247 +notmuch_indexopts_get_gpg_path (const notmuch_indexopts_t *indexopts);
\r
250 + * Destroy a notmuch_indexopts_t object.
\r
253 +notmuch_indexopts_destroy (notmuch_indexopts_t *options);
\r