From: Jani Nikula <jani@nikula.org>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] CLI: make gpg binary used by libgmime configurable.
Date: Sat, 07 Mar 2015 19:20:12 +0200 [thread overview]
Message-ID: <87d24kiv1v.fsf@nikula.org> (raw)
In-Reply-To: <1418155271-23704-2-git-send-email-david@tethera.net>
On Tue, 09 Dec 2014, David Bremner <david@tethera.net> wrote:
> 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.
This should probably add the section comment in notmuch_config_open().
For a lot of things we add the default to the config if it isn't there
already. I'm undecided whether this is a good approach in general, and
whether we should push the "gpg" hardcoding to the config code. For the
time being I'm fine with this as it is, and we should probably have a
look at the config code at a later time anyway.
Is "gpg" as a section name too specific? Does this lead to having to add
other sections for crypto/security/privacy stuff if it isn't related to
gpg? *shrug*.
BR,
Jani.
> ---
> 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
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2015-03-07 17:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 20:01 [PATCH 1/2] CLI: set up infrastructure to make path to gpg configurable David Bremner
2014-12-09 20:01 ` [PATCH 2/2] CLI: make gpg binary used by libgmime configurable David Bremner
2015-03-07 17:20 ` Jani Nikula [this message]
2015-03-07 17:13 ` [PATCH 1/2] CLI: set up infrastructure to make path to gpg configurable Jani Nikula
2015-03-09 20:51 ` [Patch v2 " David Bremner
2015-03-09 20:51 ` [Patch v2 2/2] CLI: make gpg binary used by libgmime configurable David Bremner
2015-03-11 7:15 ` [Patch v2 1/2] CLI: set up infrastructure to make path to gpg configurable David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d24kiv1v.fsf@nikula.org \
--to=jani@nikula.org \
--cc=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).