changeset 2233:90c25a29fb35

New option: 'gpg_path' The path to the gpg binary can now be specified in order to force the use of GnuPG version 1 on systems which have both versions installed.
author Holger Weiß <holger@zedat.fu-berlin.de>
date Sat, 21 Nov 2015 17:44:55 +0100
parents c06488852cdc
children 232c26383fc4
files mcabber/mcabber/pgp.c mcabber/mcabberrc.example
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/pgp.c	Sun Nov 15 17:05:07 2015 +0100
+++ b/mcabber/mcabber/pgp.c	Sat Nov 21 17:44:55 2015 +0100
@@ -32,9 +32,10 @@
 #include <glib.h>
 
 #include "pgp.h"
+#include "settings.h"
 #include "logprint.h"
 
-#define MIN_GPGME_VERSION "1.0.0"
+#define MIN_GPGME_VERSION "1.1.0"
 
 static struct gpg_struct
 {
@@ -56,6 +57,7 @@
 
   gpgme_ctx_t ctx;
   gpgme_engine_info_t info;
+  const char *gpg_path;
 
   // Check for version and OpenPGP protocol support.
   if (!gpgme_check_version(MIN_GPGME_VERSION)) {
@@ -75,6 +77,14 @@
   gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));
   gpgme_set_locale(NULL, LC_MESSAGES, setlocale(LC_MESSAGES, NULL));
 
+  // 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);
+    if (err) return -1;
+  }
+
   // Store private data.
   gpg_set_private_key(priv_key);
   gpg_set_passphrase(passphrase);
--- a/mcabber/mcabberrc.example	Sun Nov 15 17:05:07 2015 +0100
+++ b/mcabber/mcabberrc.example	Sat Nov 21 17:44:55 2015 +0100
@@ -75,6 +75,10 @@
 # can change it here.  If this number is < 0, mcabber will keep asking
 # until the passphrase is good.
 #set pgp_passphrase_retries = 2
+#
+# 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
 
 # Conference nickname
 # This nickname is used when joining a room, when no nick is explicitly