]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-show.c
cli/show: use decryption policy "auto" by default.
[notmuch] / notmuch-show.c
index 7ee9685aad0f9dca3701972b54d0efef24bfcd8f..c8f5a48f78312744505e4637683a1a5fdeab6377 100644 (file)
@@ -1083,13 +1083,14 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
        .part = -1,
        .omit_excluded = true,
        .output_body = true,
        .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;
     };
     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 =
 
     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 = &params.entire_thread, .name = "entire-thread",
          .present = &entire_thread_set },
        { .opt_int = &params.part, .name = "part" },
        { .opt_bool = &params.entire_thread, .name = "entire-thread",
          .present = &entire_thread_set },
        { .opt_int = &params.part, .name = "part" },
-       { .opt_bool = &decrypt, .name = "decrypt" },
+       { .opt_bool = &decrypt, .name = "decrypt", .present = &decrypt_set },
        { .opt_bool = &params.crypto.verify, .name = "verify" },
        { .opt_bool = &params.output_body, .name = "body" },
        { .opt_bool = &params.include_html, .name = "include-html" },
        { .opt_bool = &params.crypto.verify, .name = "verify" },
        { .opt_bool = &params.output_body, .name = "body" },
        { .opt_bool = &params.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]);
 
 
     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 */
     }
 
     /* specifying a part implies single message display */