Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
-
b7cb8019
by Philipp Hörist at 2019-02-19T16:52:43Z
-
e83b5d4d
by Philipp Hörist at 2019-02-19T18:01:17Z
3 changed files:
Changes:
| ... | ... | @@ -86,7 +86,7 @@ class Annotations: |
| 86 | 86 |
|
| 87 | 87 |
log.info('Received annotations from %s:', self.domain)
|
| 88 | 88 |
for note in notes:
|
| 89 |
- log.info(notes)
|
|
| 89 |
+ log.info(note)
|
|
| 90 | 90 |
return notes
|
| 91 | 91 |
|
| 92 | 92 |
@call_on_response('_default_response')
|
| ... | ... | @@ -19,6 +19,7 @@ import logging |
| 19 | 19 |
|
| 20 | 20 |
from nbxmpp.protocol import NS_EME
|
| 21 | 21 |
from nbxmpp.structs import StanzaHandler
|
| 22 |
+from nbxmpp.structs import EMEData
|
|
| 22 | 23 |
|
| 23 | 24 |
log = logging.getLogger('nbxmpp.m.eme')
|
| 24 | 25 |
|
| ... | ... | @@ -35,16 +36,15 @@ class EME: |
| 35 | 36 |
|
| 36 | 37 |
@staticmethod
|
| 37 | 38 |
def _process_eme(_con, stanza, properties):
|
| 38 |
- enc_tag = stanza.getTag('encryption', namespace=NS_EME)
|
|
| 39 |
- if enc_tag is None:
|
|
| 39 |
+ encryption = stanza.getTag('encryption', namespace=NS_EME)
|
|
| 40 |
+ if encryption is None:
|
|
| 40 | 41 |
return
|
| 41 | 42 |
|
| 42 |
- ns = enc_tag.getAttr('namespace')
|
|
| 43 |
- if ns is None:
|
|
| 43 |
+ name = encryption.getAttr('name')
|
|
| 44 |
+ namespace = encryption.getAttr('namespace')
|
|
| 45 |
+ if namespace is None:
|
|
| 44 | 46 |
log.warning('No namespace on message')
|
| 45 | 47 |
return
|
| 46 | 48 |
|
| 47 |
- properties.eme = {}
|
|
| 48 |
- properties.eme['namespace'] = ns
|
|
| 49 |
- properties.eme['name'] = enc_tag.getAttr('name')
|
|
| 49 |
+ properties.eme = EMEData(name=name, namespace=namespace)
|
|
| 50 | 50 |
log.info('Found data: %s', properties.eme)
|
| ... | ... | @@ -98,6 +98,8 @@ OMEMOMessage = namedtuple('OMEMOMessage', 'sid iv keys payload') |
| 98 | 98 |
AnnotationNote = namedtuple('AnnotationNote', 'jid data cdate mdate')
|
| 99 | 99 |
AnnotationNote.__new__.__defaults__ = (None, None)
|
| 100 | 100 |
|
| 101 |
+EMEData = namedtuple('EMEData', 'name namespace')
|
|
| 102 |
+ |
|
| 101 | 103 |
|
| 102 | 104 |
class OMEMOBundle(namedtuple('OMEMOBundle', 'spk spk_signature ik otpks')):
|
| 103 | 105 |
def pick_prekey(self):
|