From be6b0efb0f9de8dc1141dcabb641f177f8d27486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 29 Dec 2018 12:44:37 +0100 Subject: [PATCH] xep_0384: rework _store_device_ids method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugin.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/plugin.py b/plugin.py index 9431033..a9edf1a 100644 --- a/plugin.py +++ b/plugin.py @@ -215,13 +215,9 @@ class XEP_0384(BasePlugin): def _store_device_ids(self, jid: str, items) -> None: device_ids = [] # type: List[int] - for item in items: - device_ids = [int(d['id']) for d in item['devices']] - - # 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)) + items = list(items) + device_ids = [int(d['id']) for d in items[0]['devices']] + return self._omemo.newDeviceList(str(jid), device_ids) def _receive_device_list(self, msg: Message) -> None: if msg['pubsub_event']['items']['node'] != OMEMO_DEVICES_NS: