xep_0384: rework _store_device_ids method

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2018-12-29 12:44:37 +01:00
parent 8d35f7f80a
commit be6b0efb0f

View file

@ -215,13 +215,9 @@ class XEP_0384(BasePlugin):
def _store_device_ids(self, jid: str, items) -> None: def _store_device_ids(self, jid: str, items) -> None:
device_ids = [] # type: List[int] device_ids = [] # type: List[int]
for item in items: items = list(items)
device_ids = [int(d['id']) for d in item['devices']] device_ids = [int(d['id']) for d in items[0]['devices']]
return self._omemo.newDeviceList(str(jid), device_ids)
# XXX: There should only be one item so this is fine, but slixmpp
# loops forever otherwise. ???
break
return self._omemo.newDeviceList(device_ids, str(jid))
def _receive_device_list(self, msg: Message) -> None: def _receive_device_list(self, msg: Message) -> None:
if msg['pubsub_event']['items']['node'] != OMEMO_DEVICES_NS: if msg['pubsub_event']['items']['node'] != OMEMO_DEVICES_NS: