Make session_start handler async and use asyncio helper in it

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-24 00:14:41 +02:00
parent 0e65c68371
commit 869b11d322
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -223,11 +223,13 @@ class XEP_0384(BasePlugin):
self.xmpp.remove_event_handler('omemo_device_list_publish', self._receive_device_list)
self.xmpp['xep_0163'].remove_interest(OMEMO_DEVICES_NS)
def session_start(self, _jid):
async def session_start(self, _jid):
if self.backend_loaded:
self.xmpp['xep_0163'].add_interest(OMEMO_DEVICES_NS)
asyncio.ensure_future(self._set_device_list())
asyncio.ensure_future(self._publish_bundle())
await asyncio.wait([
self._set_device_list(),
self._publish_bundle(),
])
def my_device_id(self) -> int:
return self._device_id