Compare commits
No commits in common. "await-task" and "main" have entirely different histories.
await-task
...
main
1 changed files with 6 additions and 4 deletions
|
@ -236,6 +236,7 @@ class XEP_0384(BasePlugin):
|
|||
"no data directory specified.")
|
||||
|
||||
self._device_id = _load_device_id(self.data_dir)
|
||||
asyncio.create_task(self.session_start_omemo())
|
||||
|
||||
self.xmpp.add_event_handler('session_start', self.session_start)
|
||||
self.xmpp['xep_0060'].map_node_event(OMEMO_DEVICES_NS, 'omemo_device_list')
|
||||
|
@ -244,7 +245,7 @@ class XEP_0384(BasePlugin):
|
|||
# If this plugin is loaded after 'session_start' has fired, we still
|
||||
# need to publish bundles
|
||||
if self.xmpp.is_connected and not self._initial_publish_done:
|
||||
asyncio.ensure_future(self.session_start(None))
|
||||
asyncio.create_task(self._initial_publish())
|
||||
|
||||
def plugin_end(self):
|
||||
if not self.backend_loaded:
|
||||
|
@ -254,7 +255,7 @@ 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)
|
||||
|
||||
async def session_start(self, _jid):
|
||||
async def session_start_omemo(self):
|
||||
"""Creates the OMEMO session object"""
|
||||
|
||||
storage = self.storage_backend
|
||||
|
@ -276,14 +277,15 @@ class XEP_0384(BasePlugin):
|
|||
log.error("Couldn't load the OMEMO object; ¯\\_(ツ)_/¯")
|
||||
raise PluginCouldNotLoad from exn
|
||||
|
||||
await self._initial_publish()
|
||||
|
||||
def _omemo(self) -> SessionManager:
|
||||
"""Helper method to unguard potentially uninitialized SessionManager"""
|
||||
if self.__omemo_session is None:
|
||||
raise UninitializedOMEMOSession
|
||||
return self.__omemo_session
|
||||
|
||||
async def session_start(self, _jid):
|
||||
await self._initial_publish()
|
||||
|
||||
async def _initial_publish(self):
|
||||
if self.backend_loaded:
|
||||
self.xmpp['xep_0163'].add_interest(OMEMO_DEVICES_NS)
|
||||
|
|
Loading…
Reference in a new issue