about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2017-08-10 22:47:17 +0100
committerJames Booth <boothj5@gmail.com>2017-08-10 22:47:17 +0100
commitca1dcdda6cd6114061ff99963e59c76bd92e4603 (patch)
tree7ba91af6304e3c70df07ee6ffffe71c18eb626eb
parent17b4e45c5795ed191d06964feeb2d20ae7ec6e94 (diff)
downloadprofani-tty-ca1dcdda6cd6114061ff99963e59c76bd92e4603.tar.gz
Show libotr and libgpgme versions on --version
issue #956
-rw-r--r--src/main.c14
-rw-r--r--src/pgp/gpg.c5
2 files changed, 16 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 3910c47a..479e955d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -41,6 +41,14 @@
 #include "gitversion.h"
 #endif
 
+#ifdef HAVE_LIBOTR
+#include "otr/otr.h"
+#endif
+
+#ifdef HAVE_LIBGPGME
+#include "pgp/gpg.h"
+#endif
+
 #ifdef HAVE_PYTHON
 #include "plugins/python_plugins.h"
 #endif
@@ -117,13 +125,15 @@ main(int argc, char **argv)
         }
 
 #ifdef HAVE_LIBOTR
-        g_print("OTR support: Enabled\n");
+        char *otr_version = otr_libotr_version();
+        g_print("OTR support: Enabled (libotr %s)\n", otr_version);
 #else
         g_print("OTR support: Disabled\n");
 #endif
 
 #ifdef HAVE_LIBGPGME
-        g_print("PGP support: Enabled\n");
+        const char *pgp_version = p_gpg_libver();
+        g_print("PGP support: Enabled (libgpgme %s)\n", pgp_version);
 #else
         g_print("PGP support: Disabled\n");
 #endif
diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c
index 051f99f0..4654ee31 100644
--- a/src/pgp/gpg.c
+++ b/src/pgp/gpg.c
@@ -56,7 +56,7 @@
 #define PGP_MESSAGE_HEADER "-----BEGIN PGP MESSAGE-----"
 #define PGP_MESSAGE_FOOTER "-----END PGP MESSAGE-----"
 
-static const char *libversion;
+static const char *libversion = NULL;
 static GHashTable *pubkeys;
 
 static gchar *pubsloc;
@@ -420,6 +420,9 @@ p_gpg_pubkeys(void)
 const char*
 p_gpg_libver(void)
 {
+    if (libversion == NULL) {
+        libversion = gpgme_check_version(NULL);
+    }
     return libversion;
 }