1 /* indexopts.c - options for indexing messages (currently a stub)
3 * Copyright © 2017 Daniel Kahn Gillmor
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.
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.
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/ .
18 * Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
21 #include "notmuch-private.h"
24 notmuch_database_get_default_indexopts (notmuch_database_t *db)
26 notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t);
29 ret->crypto.decrypt = NOTMUCH_DECRYPT_FALSE;
31 char * decrypt_policy;
32 notmuch_status_t err = notmuch_database_get_config (db, "index.decrypt", &decrypt_policy);
37 ((!(strcasecmp(decrypt_policy, "true"))) ||
38 (!(strcasecmp(decrypt_policy, "yes"))) ||
39 (!(strcasecmp(decrypt_policy, "1")))))
40 notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_TRUE);
42 free (decrypt_policy);
47 notmuch_indexopts_set_decrypt_policy (notmuch_indexopts_t *indexopts,
48 notmuch_decryption_policy_t decrypt_policy)
51 return NOTMUCH_STATUS_NULL_POINTER;
52 indexopts->crypto.decrypt = decrypt_policy;
53 return NOTMUCH_STATUS_SUCCESS;
56 notmuch_decryption_policy_t
57 notmuch_indexopts_get_decrypt_policy (const notmuch_indexopts_t *indexopts)
61 return indexopts->crypto.decrypt;
65 notmuch_indexopts_destroy (notmuch_indexopts_t *indexopts)
67 talloc_free (indexopts);