detect when gpg is not installed and print a warning. fixes #2760

This commit is contained in:
Yann Leboulanger 2006-12-13 12:29:24 +00:00
parent fd13baefc4
commit 0fb837f74f
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@
## GNU General Public License for more details. ## GNU General Public License for more details.
## ##
import os
from os import tmpfile from os import tmpfile
from common import helpers 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! USE_GPG = False # user can't do OpenGPG only if he or she removed the file!
else: else:
status = os.system('gpg -h >/dev/null 2>&1')
if status != 0:
USE_GPG = False
class GnuPG(GnuPGInterface.GnuPG): class GnuPG(GnuPGInterface.GnuPG):
def __init__(self): def __init__(self):
GnuPGInterface.GnuPG.__init__(self) GnuPGInterface.GnuPG.__init__(self)

View File

@ -2687,6 +2687,9 @@ class RosterWindow:
save_gpg_pass = gajim.config.get_per('accounts', account, save_gpg_pass = gajim.config.get_per('accounts', account,
'savegpgpass') 'savegpgpass')
keyid = gajim.config.get_per('accounts', account, 'keyid') 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 \ if keyid and gajim.connections[account].connected < 2 and \
gajim.config.get('usegpg'): gajim.config.get('usegpg'):