]> git.notmuchmail.org Git - notmuch/blob - lib/indexopts.c
index: implement notmuch_indexopts_t with try_decrypt
[notmuch] / lib / indexopts.c
1 /* indexopts.c - options for indexing messages (currently a stub)
2  *
3  * Copyright © 2017 Daniel Kahn Gillmor
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see https://www.gnu.org/licenses/ .
17  *
18  * Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
19  */
20
21 #include "notmuch-private.h"
22
23 notmuch_indexopts_t *
24 notmuch_database_get_default_indexopts (notmuch_database_t *db)
25 {
26     return talloc_zero (db, notmuch_indexopts_t);
27 }
28
29 notmuch_status_t
30 notmuch_indexopts_set_try_decrypt (notmuch_indexopts_t *indexopts,
31                                    notmuch_bool_t try_decrypt)
32 {
33     if (!indexopts)
34         return NOTMUCH_STATUS_NULL_POINTER;
35     indexopts->crypto.decrypt = try_decrypt;
36     return NOTMUCH_STATUS_SUCCESS;
37 }
38
39 notmuch_bool_t
40 notmuch_indexopts_get_try_decrypt (const notmuch_indexopts_t *indexopts)
41 {
42     if (!indexopts)
43         return false;
44     return indexopts->crypto.decrypt;
45 }
46
47 void
48 notmuch_indexopts_destroy (notmuch_indexopts_t *indexopts)
49 {
50     talloc_free (indexopts);
51 }