diff options
| author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2017-12-08 01:23:55 -0500 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-12-08 08:08:46 -0400 |
| commit | a1260896f6b2beb82f46c41663f00cb42a4c5ce7 (patch) | |
| tree | 58ee2b185f4c3fa98b865ceab204128827ec8ae9 /notmuch-show.c | |
| parent | 6802b333eb356fdeafd97a4e4ed74999d055a852 (diff) | |
cli/show: use decryption policy "auto" by default.
When showing a message, if the user doesn't specify --decrypt= at all,
but a stashed session key is known to notmuch, notmuch should just go
ahead and try to decrypt the message with the session key (without
bothering the user for access to their asymmetric secret key).
The user can disable this at the command line with --decrypt=false if
they really don't want to look at the e-mail that they've asked
notmuch to show them.
and of course, "notmuch show --decrypt" still works for accessing the
user's secret keys if necessary.
Diffstat (limited to 'notmuch-show.c')
| -rw-r--r-- | notmuch-show.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/notmuch-show.c b/notmuch-show.c index 7ee9685a..c8f5a48f 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1083,13 +1083,14 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) .part = -1, .omit_excluded = true, .output_body = true, - .crypto = { .decrypt = NOTMUCH_DECRYPT_FALSE }, + .crypto = { .decrypt = NOTMUCH_DECRYPT_AUTO }, }; int format = NOTMUCH_FORMAT_NOT_SPECIFIED; bool exclude = true; bool entire_thread_set = false; bool single_message; bool decrypt = false; + bool decrypt_set = false; notmuch_opt_desc_t options[] = { { .opt_keyword = &format, .name = "format", .keywords = @@ -1104,7 +1105,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) { .opt_bool = ¶ms.entire_thread, .name = "entire-thread", .present = &entire_thread_set }, { .opt_int = ¶ms.part, .name = "part" }, - { .opt_bool = &decrypt, .name = "decrypt" }, + { .opt_bool = &decrypt, .name = "decrypt", .present = &decrypt_set }, { .opt_bool = ¶ms.crypto.verify, .name = "verify" }, { .opt_bool = ¶ms.output_body, .name = "body" }, { .opt_bool = ¶ms.include_html, .name = "include-html" }, @@ -1118,10 +1119,14 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_process_shared_options (argv[0]); - if (decrypt) { - params.crypto.decrypt = NOTMUCH_DECRYPT_TRUE; - /* decryption implies verification */ - params.crypto.verify = true; + if (decrypt_set) { + if (decrypt) { + params.crypto.decrypt = NOTMUCH_DECRYPT_TRUE; + /* decryption implies verification */ + params.crypto.verify = true; + } else { + params.crypto.decrypt = NOTMUCH_DECRYPT_FALSE; + } } /* specifying a part implies single message display */ |
