diff options
| author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2017-10-20 22:25:43 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-10-21 19:54:33 -0300 |
| commit | d0da7a0a1c24b937eb754e8f73e5cf7e3857f24a (patch) | |
| tree | df1653889925115c1465b98c8bdf86bef173db69 /lib | |
| parent | 886c0b1666478548485682fbcaa667bb3cc0f138 (diff) | |
config: define new option index.try_decrypt
By default, notmuch won't try to decrypt on indexing. With this
patch, we make it possible to indicate a per-database preference using
the config variable "index.try_decrypt", which by default will be
false.
At indexing time, the database needs some way to know its internal
defaults for how to index encrypted parts. It shouldn't be contingent
on an external config file (since that can't be retrieved from the
database object itself), so we store it in the database.
This behaves similarly to the query.* configurations, which are also
stored in the database itself, so we're not introducing any new
dependencies by requiring that it be stored in the database.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/indexopts.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/indexopts.c b/lib/indexopts.c index 51b56dd7..15c31d24 100644 --- a/lib/indexopts.c +++ b/lib/indexopts.c @@ -23,7 +23,23 @@ notmuch_indexopts_t * notmuch_database_get_default_indexopts (notmuch_database_t *db) { - return talloc_zero (db, notmuch_indexopts_t); + notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t); + if (!ret) + return ret; + + char * try_decrypt; + notmuch_status_t err = notmuch_database_get_config (db, "index.try_decrypt", &try_decrypt); + if (err) + return ret; + + if (try_decrypt && + ((!(strcasecmp(try_decrypt, "true"))) || + (!(strcasecmp(try_decrypt, "yes"))) || + (!(strcasecmp(try_decrypt, "1"))))) + notmuch_indexopts_set_try_decrypt (ret, true); + + free (try_decrypt); + return ret; } notmuch_status_t |
