diff options
| author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2018-05-11 02:57:59 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2018-05-26 07:43:30 -0700 |
| commit | aa605f7e8a4c5e046503d61fdb953721c32f9d3a (patch) | |
| tree | a6ff27d527404fba5dfb2ae20d4f44adbb14b750 /notmuch-show.c | |
| parent | 9d114a855260b3df194691c9bbf904fa08a3f0d0 (diff) | |
cli/show: enable --decrypt=stash
Add fancy new feature, which makes "notmuch show" capable of actually
indexing messages that it just decrypted.
This enables a workflow where messages can come in in the background
and be indexed using "--decrypt=auto". But when showing an encrypted
message for the first time, it gets automatically indexed.
This is something of a departure for "notmuch show" -- in particular,
because it requires read/write access to the database. However, this
might be a common use case -- people get mail delivered and indexed in
the background, but only want access to their secret key to happen
when they're directly interacting with notmuch itself.
In such a scenario, they couldn't search newly-delivered, encrypted
messages, but they could search for them once they've read them.
Documentation of this new feature also uses a table form, similar to
that found in the description of index.decrypt in notmuch-config(1).
A notmuch UI that wants to facilitate this workflow while also
offering an interactive search interface might instead make use of
these additional commands while the user is at the console:
Count received encrypted messages (if > 0, there are some things we
haven't yet tried to index, and therefore can't yet search):
notmuch count tag:encrypted and \
not property:index.decryption=success and \
not property:index.decryption=failure
Reindex those messages:
notmuch reindex --try-decrypt=true tag:encrypted and \
not property:index.decryption=success and \
not property:index.decryption=failure
Diffstat (limited to 'notmuch-show.c')
| -rw-r--r-- | notmuch-show.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/notmuch-show.c b/notmuch-show.c index 3d10f3b2..1072ea55 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1124,6 +1124,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE }, { "auto", NOTMUCH_DECRYPT_AUTO }, { "true", NOTMUCH_DECRYPT_NOSTASH }, + { "stash", NOTMUCH_DECRYPT_TRUE }, { 0, 0 } } }, { .opt_bool = ¶ms.crypto.verify, .name = "verify" }, { .opt_bool = ¶ms.output_body, .name = "body" }, @@ -1139,7 +1140,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_process_shared_options (argv[0]); /* explicit decryption implies verification */ - if (params.crypto.decrypt == NOTMUCH_DECRYPT_NOSTASH) + if (params.crypto.decrypt == NOTMUCH_DECRYPT_NOSTASH || + params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE) params.crypto.verify = true; /* specifying a part implies single message display */ @@ -1202,8 +1204,11 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config); #endif + notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY; + if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE) + mode = NOTMUCH_DATABASE_MODE_READ_WRITE; if (notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) + mode, ¬much)) return EXIT_FAILURE; notmuch_exit_if_unmatched_db_uuid (notmuch); |
