we now handle when the user doesn't give his OpenPGP passphrase and print an error message

This commit is contained in:
Yann Leboulanger 2005-06-18 16:57:57 +00:00
parent 0bc0b5f783
commit 7538333c5d
2 changed files with 13 additions and 9 deletions

View File

@ -724,14 +724,18 @@ class Connection:
signed = '' signed = ''
keyID = gajim.config.get_per('accounts', self.name, 'keyid') keyID = gajim.config.get_per('accounts', self.name, 'keyid')
if keyID and USE_GPG: if keyID and USE_GPG:
if not msg: if self.connected < 2 and self.gpg.passphrase == None: # We didn't set a passphrase
lowered_uf_status_msg = helpers.get_uf_show(show).lower() self.dispatch('ERROR', (_('OpenPGP Key was not given'),
msg = _("I'm %s") % lowered_uf_status_msg _('You will be connected to %s without OpenPGP.') % self.name))
signed = self.gpg.sign(msg, keyID) else:
if signed == 'BAD_PASSPHRASE': if not msg:
signed = '' lowered_uf_status_msg = helpers.get_uf_show(show).lower()
if self.connected < 2: msg = _("I'm %s") % lowered_uf_status_msg
self.dispatch('BAD_PASSPHRASE', ()) signed = self.gpg.sign(msg, keyID)
if signed == 'BAD_PASSPHRASE':
signed = ''
if self.connected < 2:
self.dispatch('BAD_PASSPHRASE', ())
self.status = msg self.status = msg
if show != 'offline' and not self.connected: if show != 'offline' and not self.connected:
self.connection = self.connect() self.connection = self.connect()

View File

@ -907,7 +907,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
_('Save passphrase')) _('Save passphrase'))
passphrase, save = w.run() passphrase, save = w.run()
if passphrase == -1: if passphrase == -1:
passphrase = '' passphrase = None
else: else:
self.gpg_passphrase[keyid] = passphrase self.gpg_passphrase[keyid] = passphrase
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid) gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)