changeset 4d7826936744 in /home/hg/repos/gajim
author: Yann Leboulanger <asterix(a)lagaule.org>
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=4d7826936744
description: correctly detect that key is not trusted before encrypting. Doc says: "gpg just prints a message to the console, but does not provide a specific error indication that the Python wrapper can use." Fixes #8040. See #8041
diffstat:
src/common/gnupg.py | 5 ++++-
src/common/gpg.py | 10 +++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r 2127559a62b2 -r 4d7826936744 src/common/gnupg.py
--- a/src/common/gnupg.py Tue Jul 28 20:19:19 2015 +0200
+++ b/src/common/gnupg.py Wed Jul 29 22:32:02 2015 +0200
@@ -1094,7 +1094,7 @@
getattr(result, keyword)(L)
return result
- def list_keys(self, secret=False):
+ def list_keys(self, secret=False, keys=None):
""" list the keys currently in the keyring
>>> import shutil
@@ -1116,6 +1116,9 @@
which='secret-keys'
args = ["--list-%s" % which, "--fixed-list-mode", "--fingerprint",
"--with-colons"]
+ if keys:
+ for key in keys:
+ args.append(key)
p = self._open_subprocess(args)
return self._get_list_output(p, 'list')
diff -r 2127559a62b2 -r 4d7826936744 src/common/gpg.py
--- a/src/common/gpg.py Tue Jul 28 20:19:19 2015 +0200
+++ b/src/common/gpg.py Wed Jul 29 22:32:02 2015 +0200
@@ -54,12 +54,16 @@
for key in recipients:
if key not in self.always_trust:
trust = False
+ if not trust:
+ # check that we'll be able to encrypt
+ result = super(GnuPG, self).list_keys(recipients,
+ keys=recipients)
+ for key in result:
+ if key['trust'] not in ('f', 'u'):
+ return '', 'NOT_TRUSTED'
result = super(GnuPG, self).encrypt(str_, recipients,
always_trust=trust, passphrase=self.passphrase)
- if result.status == 'invalid recipient':
- return '', 'NOT_TRUSTED'
-
if result.ok:
error = ''
else:
changeset 7aa8b24aa913 in /home/hg/repos/gajim
author: Yann Leboulanger <asterix(a)lagaule.org>
branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=7aa8b24aa913
description: do not try to go autoaway or come back from autoaway if we are not connected. See #8062
diffstat:
src/gui_interface.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diffs (22 lines):
diff -r 312de2800974 -r 7aa8b24aa913 src/gui_interface.py
--- a/src/gui_interface.py Mon Jul 27 21:19:25 2015 +0200
+++ b/src/gui_interface.py Mon Jul 27 22:58:47 2015 +0200
@@ -2936,7 +2936,8 @@
def gnome_screensaver_ActiveChanged_cb(active):
if not active:
for account in gajim.connections:
- if gajim.sleeper_state[account] == 'autoaway-forced':
+ if gajim.account_is_connected(account) and \
+ gajim.sleeper_state[account] == 'autoaway-forced':
# We came back online ofter gnome-screensaver
# autoaway
self.roster.send_status(account, 'online',
@@ -2952,6 +2953,8 @@
not gajim.sleeper_state[account]:
continue
if gajim.sleeper_state[account] == 'online':
+ if not gajim.account_is_connected(account):
+ continue
# we save out online status
gajim.status_before_autoaway[account] = \
gajim.connections[account].status