fix the "do not ask me again" behaviour with untrusted GPG key warning. Fixes #7584
This commit is contained in:
parent
cb98239794
commit
1b0406a814
|
@ -326,7 +326,7 @@ class CommonConnection:
|
|||
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,
|
||||
|
|
|
@ -34,7 +34,7 @@ if HAVE_GPG:
|
|||
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 @@ if HAVE_GPG:
|
|||
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'
|
||||
|
|
|
@ -695,7 +695,7 @@ class Interface:
|
|||
#('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():
|
||||
|
|
Loading…
Reference in New Issue