[openpgp] Bugfixes
- Parse datetime correctly and convert to int - Query contact keys on openpgp activation
This commit is contained in:
@@ -382,6 +382,8 @@ class OpenPGP:
|
|||||||
else:
|
else:
|
||||||
from_jid = from_jid.getStripped()
|
from_jid = from_jid.getStripped()
|
||||||
|
|
||||||
|
log.info('Key list query received from %s', from_jid)
|
||||||
|
|
||||||
keylist = util.unpack_public_key_list(stanza, from_jid)
|
keylist = util.unpack_public_key_list(stanza, from_jid)
|
||||||
self.key_list_received(keylist, from_jid)
|
self.key_list_received(keylist, from_jid)
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ class PGPKeylist(AbstractPEPModule):
|
|||||||
raise StanzaMalformed('Invalid date timestamp: %s', date)
|
raise StanzaMalformed('Invalid date timestamp: %s', date)
|
||||||
|
|
||||||
keylist.append(Key(attrs['v4-fingerprint'], int(timestamp)))
|
keylist.append(Key(attrs['v4-fingerprint'], int(timestamp)))
|
||||||
|
|
||||||
return keylist
|
return keylist
|
||||||
|
|
||||||
def _notification_received(self, jid, keylist):
|
def _notification_received(self, jid, keylist):
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ from base64 import b64decode, b64encode
|
|||||||
import nbxmpp
|
import nbxmpp
|
||||||
from nbxmpp import Node
|
from nbxmpp import Node
|
||||||
|
|
||||||
|
from gajim.common.modules.date_and_time import parse_datetime
|
||||||
|
|
||||||
NS_OPENPGP = 'urn:xmpp:openpgp:0'
|
NS_OPENPGP = 'urn:xmpp:openpgp:0'
|
||||||
NS_OPENPGP_PUBLIC_KEYS = 'urn:xmpp:openpgp:0:public-keys'
|
NS_OPENPGP_PUBLIC_KEYS = 'urn:xmpp:openpgp:0:public-keys'
|
||||||
NS_NOTIFY = NS_OPENPGP_PUBLIC_KEYS + '+notify'
|
NS_NOTIFY = NS_OPENPGP_PUBLIC_KEYS + '+notify'
|
||||||
@@ -89,9 +91,17 @@ def unpack_public_key_list(stanza, from_jid):
|
|||||||
return
|
return
|
||||||
|
|
||||||
date = attrs.get('date', None)
|
date = attrs.get('date', None)
|
||||||
|
if date is None:
|
||||||
|
log.warning('No date in metadata')
|
||||||
|
return
|
||||||
|
|
||||||
|
timestamp = parse_datetime(date, epoch=True)
|
||||||
|
if timestamp is None:
|
||||||
|
log.warning('Invalid date timestamp: %s', date)
|
||||||
|
return
|
||||||
|
|
||||||
fingerprints.append(
|
fingerprints.append(
|
||||||
Key(attrs['v4-fingerprint'], date))
|
Key(attrs['v4-fingerprint'], int(timestamp)))
|
||||||
|
|
||||||
return fingerprints
|
return fingerprints
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ class OpenPGPPlugin(GajimPlugin):
|
|||||||
keys = app.connections[account].get_module('OpenPGP').get_keys(
|
keys = app.connections[account].get_module('OpenPGP').get_keys(
|
||||||
jid, only_trusted=False)
|
jid, only_trusted=False)
|
||||||
if not keys:
|
if not keys:
|
||||||
|
con.get_module('OpenPGP').query_key_list(jid)
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
_('No OpenPGP key'),
|
_('No OpenPGP key'),
|
||||||
_('We didnt receive a OpenPGP key from this contact.'))
|
_('We didnt receive a OpenPGP key from this contact.'))
|
||||||
|
|||||||
Reference in New Issue
Block a user