From 0fb837f74f581329fbe331f0b2fa8a8e7dc267bf Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 13 Dec 2006 12:29:24 +0000
Subject: [PATCH] detect when gpg is not installed and print a warning. fixes
 #2760

---
 src/common/GnuPG.py  | 5 +++++
 src/roster_window.py | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/src/common/GnuPG.py b/src/common/GnuPG.py
index 02e4838aa4..5ecb530b81 100644
--- a/src/common/GnuPG.py
+++ b/src/common/GnuPG.py
@@ -23,6 +23,7 @@
 ## GNU General Public License for more details.
 ##
 
+import os
 from os import tmpfile
 from common import helpers
 
@@ -37,6 +38,10 @@ except ImportError:
 		USE_GPG = False # user can't do OpenGPG only if he or she removed the file!
 	
 else:
+	status = os.system('gpg -h >/dev/null 2>&1')
+	if status != 0:
+		USE_GPG = False
+
 	class GnuPG(GnuPGInterface.GnuPG):
 		def __init__(self):
 			GnuPGInterface.GnuPG.__init__(self)
diff --git a/src/roster_window.py b/src/roster_window.py
index a92d3a4c7e..96388f5d4d 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -2687,6 +2687,9 @@ class RosterWindow:
 				save_gpg_pass = gajim.config.get_per('accounts', account,
 					'savegpgpass')
 			keyid = gajim.config.get_per('accounts', account, 'keyid')
+			if keyid and not gajim.config.get('usegpg'):
+				#TODO: make this string translatable
+				dialog = dialogs.WarningDialog('GPG is not usable', _('You will be connected to %s without OpenPGP.') % account)
 			if keyid and gajim.connections[account].connected < 2 and \
 				gajim.config.get('usegpg'):
 
-- 
GitLab