Use session_start instead of session_bind to ensure we're authenticated

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-22 19:44:21 +02:00
parent a07c3d9745
commit bf2b2283f5
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -210,6 +210,7 @@ class XEP_0384(BasePlugin):
log.error("Couldn't load the OMEMO object; ¯\\_(ツ)_/¯")
raise PluginCouldNotLoad
self.xmpp.add_event_handler('session_start', self.session_start)
self.xmpp['xep_0060'].map_node_event(OMEMO_DEVICES_NS, 'omemo_device_list')
self.xmpp.add_event_handler('omemo_device_list_publish', self._receive_device_list)
return None
@ -218,10 +219,11 @@ class XEP_0384(BasePlugin):
if not self.backend_loaded:
return
self.xmpp.remove_event_handler('session_start', self.session_start)
self.xmpp.remove_event_handler('omemo_device_list_publish', self._receive_device_list)
self.xmpp['xep_0163'].remove_interest(OMEMO_DEVICES_NS)
def session_bind(self, _jid):
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())