X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-show.c;h=9871159ded91ea66bed6cd45d6192e25b099b6cd;hp=d5adc37007b884a9719be042a1374667c176c81a;hb=8ea4a99d74737929f58568505e41c94f65a14743;hpb=0ada2a05c94de72bc2c7c57a790e92b77af37a42 diff --git a/notmuch-show.c b/notmuch-show.c index d5adc370..9871159d 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1085,8 +1085,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) 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 = @@ -1101,7 +1099,12 @@ 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", .present = &decrypt_set }, + { .opt_keyword = (int*)(¶ms.crypto.decrypt), .name = "decrypt", + .keyword_no_arg_value = "true", .keywords = + (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE }, + { "auto", NOTMUCH_DECRYPT_AUTO }, + { "true", NOTMUCH_DECRYPT_NOSTASH }, + { 0, 0 } } }, { .opt_bool = ¶ms.crypto.verify, .name = "verify" }, { .opt_bool = ¶ms.output_body, .name = "body" }, { .opt_bool = ¶ms.include_html, .name = "include-html" }, @@ -1115,16 +1118,9 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_process_shared_options (argv[0]); - if (decrypt_set) { - if (decrypt) { - /* we do not need or want to ask for session keys */ - params.crypto.decrypt = NOTMUCH_DECRYPT_NOSTASH; - /* decryption implies verification */ - params.crypto.verify = true; - } else { - params.crypto.decrypt = NOTMUCH_DECRYPT_FALSE; - } - } + /* explicit decryption implies verification */ + if (params.crypto.decrypt == NOTMUCH_DECRYPT_NOSTASH) + params.crypto.verify = true; /* specifying a part implies single message display */ single_message = params.part >= 0;