changeset 0206274033da in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: gajim_0.16 details:http://hg.gajim.org/gajim?cmd=changeset;node=0206274033da description: fix the "do not ask me again" behaviour with untrusted GPG key warning. Fixes #7584
diffstat:
src/common/connection.py | 2 +- src/common/gpg.py | 10 ++++++++-- src/gui_interface.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)
diffs (52 lines):
diff -r a49c6adac288 -r 0206274033da src/common/connection.py --- a/src/common/connection.py Sat Nov 30 15:25:21 2013 +0100 +++ b/src/common/connection.py Sun Dec 01 10:06:38 2013 +0100 @@ -326,7 +326,7 @@ form_node, user_nick, keyID, attention, correction_msg, callback) gajim.nec.push_incoming_event(GPGTrustKeyEvent(None, - conn=self, callback=_on_always_trust)) + conn=self, keyID=keyID, callback=_on_always_trust)) else: self._message_encrypted_cb(output, type_, msg, msgtxt, original_message, fjid, resource, jid, xhtml, diff -r a49c6adac288 -r 0206274033da src/common/gpg.py --- a/src/common/gpg.py Sat Nov 30 15:25:21 2013 +0100 +++ b/src/common/gpg.py Sun Dec 01 10:06:38 2013 +0100 @@ -34,7 +34,7 @@ self.decode_errors = 'replace' self.passphrase = None self.use_agent = use_agent - self.always_trust = False + self.always_trust = [] # list of keyID to always trust
def _setup_my_options(self): self.options.armor = 1 @@ -47,8 +47,14 @@ self.options.extra_args.append('--use-agent')
def encrypt(self, str_, recipients, always_trust=False): + trust = always_trust + if not trust: + trust = True + for key in recipients: + if key not in self.always_trust: + trust = False result = super(GnuPG, self).encrypt(str_, recipients, - always_trust=always_trust, passphrase=self.passphrase) + always_trust=trust, passphrase=self.passphrase)
if result.status == 'invalid recipient': return '', 'NOT_TRUSTED' diff -r a49c6adac288 -r 0206274033da src/gui_interface.py --- a/src/gui_interface.py Sat Nov 30 15:25:21 2013 +0100 +++ b/src/gui_interface.py Sun Dec 01 10:06:38 2013 +0100 @@ -695,7 +695,7 @@ #('GPG_ALWAYS_TRUST', account, callback) def on_yes(checked): if checked: - obj.conn.gpg.always_trust = True + obj.conn.gpg.always_trust.append(obj.keyID) obj.callback(True)
def on_no():