diff mcabber/mcabber/pgp.c @ 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 048cff929e4d
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;
   }