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 <group>.<key> 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