From 7be3679b4d5d99c43a72d1077d3a20b6207de802 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 9 Dec 2014 21:01:11 +0100 Subject: [PATCH] [PATCH 2/2] CLI: make gpg binary used by libgmime configurable. --- a3/6c759a0de47e9ce13e9fbae17486ef2a051592 | 139 ++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 a3/6c759a0de47e9ce13e9fbae17486ef2a051592 diff --git a/a3/6c759a0de47e9ce13e9fbae17486ef2a051592 b/a3/6c759a0de47e9ce13e9fbae17486ef2a051592 new file mode 100644 index 000000000..0edc46af7 --- /dev/null +++ b/a3/6c759a0de47e9ce13e9fbae17486ef2a051592 @@ -0,0 +1,139 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 44C9E431FD9 + for ; Tue, 9 Dec 2014 12:01:30 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id yQ9GX9FOOMN0 for ; + Tue, 9 Dec 2014 12:01:28 -0800 (PST) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id EA9B6431FD4 + for ; Tue, 9 Dec 2014 12:01:27 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1XyQyN-0003HM-I1; Tue, 09 Dec 2014 16:01:27 -0400 +Received: (nullmailer pid 23749 invoked by uid 1000); Tue, 09 Dec 2014 + 20:01:16 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] CLI: make gpg binary used by libgmime configurable. +Date: Tue, 9 Dec 2014 21:01:11 +0100 +Message-Id: <1418155271-23704-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.3 +In-Reply-To: <1418155271-23704-1-git-send-email-david@tethera.net> +References: <1418155271-23704-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 09 Dec 2014 20:01:30 -0000 + +Previously we set up a way for the top level notmuch command to choose +which gpg binary was invoked by libgmime. In this commit we add the +(mostly boilplate) code to allow the notmuch-config command to read +and write this path, and use it in the appropriate struct. +--- + notmuch-client.h | 7 +++++++ + notmuch-config.c | 15 +++++++++++++++ + notmuch-reply.c | 2 ++ + notmuch-show.c | 2 ++ + 4 files changed, 26 insertions(+) + +diff --git a/notmuch-client.h b/notmuch-client.h +index c25c4ea..fad81d5 100644 +--- a/notmuch-client.h ++++ b/notmuch-client.h +@@ -279,6 +279,13 @@ notmuch_config_set_database_path (notmuch_config_t *config, + const char *database_path); + + const char * ++notmuch_config_get_gpg_path (notmuch_config_t *config); ++ ++void ++notmuch_config_set_gpg_path (notmuch_config_t *config, ++ const char *gpg_path); ++ ++const char * + notmuch_config_get_user_name (notmuch_config_t *config); + + void +diff --git a/notmuch-config.c b/notmuch-config.c +index a564bca..7aef1b6 100644 +--- a/notmuch-config.c ++++ b/notmuch-config.c +@@ -107,6 +107,7 @@ struct _notmuch_config { + notmuch_bool_t is_new; + + char *database_path; ++ char *gpg_path; + char *user_name; + char *user_primary_email; + const char **user_other_email; +@@ -690,6 +691,20 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config, + &(config->search_exclude_tags)); + } + ++const char * ++notmuch_config_get_gpg_path (notmuch_config_t *config) ++{ ++ return _config_get (config, &config->gpg_path, "gpg", "path"); ++} ++ ++void ++notmuch_config_set_gpg_path (notmuch_config_t *config, ++ const char *gpg_path) ++{ ++ _config_set (config, &config->gpg_path, "gpg", "path", gpg_path); ++} ++ ++ + /* Given a configuration item of the form . return the + * component group and key. If any error occurs, print a message on + * stderr and return 1. Otherwise, return 0. +diff --git a/notmuch-reply.c b/notmuch-reply.c +index e18370f..d6d3315 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -822,6 +822,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[]) + return EXIT_FAILURE; + } + ++ params.crypto.gpgpath = notmuch_config_get_gpg_path (config); ++ + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) + return EXIT_FAILURE; +diff --git a/notmuch-show.c b/notmuch-show.c +index d292f29..b0d4609 100644 +--- a/notmuch-show.c ++++ b/notmuch-show.c +@@ -1204,6 +1204,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) + return EXIT_FAILURE; + } + ++ params.crypto.gpgpath = notmuch_config_get_gpg_path (config); ++ + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) + return EXIT_FAILURE; +-- +2.1.3 + -- 2.26.2