changeset 2234:232c26383fc4

New option: 'gpg_home' The new 'gpg_home' option can be used to specify a custom configuration directory for GnuPG.
author Holger Weiß <holger@zedat.fu-berlin.de>
date Sat, 21 Nov 2015 17:44:59 +0100
parents 90c25a29fb35
children 5efdec0c45a0
files mcabber/mcabber/pgp.c mcabber/mcabberrc.example
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/pgp.c	Sat Nov 21 17:44:55 2015 +0100
+++ b/mcabber/mcabber/pgp.c	Sat Nov 21 17:44:59 2015 +0100
@@ -57,7 +57,7 @@
 
   gpgme_ctx_t ctx;
   gpgme_engine_info_t info;
-  const char *gpg_path;
+  const char *gpg_path, *gpg_home;
 
   // Check for version and OpenPGP protocol support.
   if (!gpgme_check_version(MIN_GPGME_VERSION)) {
@@ -80,8 +80,11 @@
   // The path to the gpg binary can be specified in order to force
   // version 1, for example.
   gpg_path = settings_opt_get("gpg_path");
-  if (gpg_path) {
-    err = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, gpg_path, NULL);
+  gpg_home = settings_opt_get("gpg_home");
+  if (gpg_path || gpg_home) {
+    char *xp_gpg_home = expand_filename(gpg_home);
+    err = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, gpg_path, xp_gpg_home);
+    g_free(xp_gpg_home);
     if (err) return -1;
   }
 
--- a/mcabber/mcabberrc.example	Sat Nov 21 17:44:55 2015 +0100
+++ b/mcabber/mcabberrc.example	Sat Nov 21 17:44:59 2015 +0100
@@ -79,6 +79,10 @@
 # You can specify the path to the gpg binary, e.g. to force the use of
 # GnuPG version 1 on systems which have both versions installed.
 #set gpg_path = /usr/bin/gpg
+#
+# If GnuPG should use a custom configuration directory, you can set
+# 'gpg_home' to the desired path.
+#set gpg_home = ~/.mcabber/gpg
 
 # Conference nickname
 # This nickname is used when joining a room, when no nick is explicitly