# HG changeset patch # User Goffi # Date 1556434507 -7200 # Node ID 03a09e16bf2830771c68d2037b86e0c1479a82eb # Parent 59aea54e74a85315bd379597598ecb067a5b9c0a plugin XEP-0384: wait for client to be ready if session is missing when onNewDevices is called diff -r 59aea54e74a8 -r 03a09e16bf28 sat/plugins/plugin_xep_0384.py --- a/sat/plugins/plugin_xep_0384.py Fri Apr 26 11:57:26 2019 +0200 +++ b/sat/plugins/plugin_xep_0384.py Sun Apr 28 08:55:07 2019 +0200 @@ -539,6 +539,8 @@ @defer.inlineCallbacks def profileConnected(self, client): + # FIXME: is _xep_0384_ready needed? can we use profileConnecting? + # Workflow should be checked client._xep_0384_ready = defer.Deferred() # we first need to get devices ids (including our own) persistent_dict = persistent.LazyPersistentBinaryDict("XEP-0384", client.profile) @@ -767,7 +769,11 @@ @defer.inlineCallbacks def onNewDevices(self, itemsEvent, profile): client = self.host.getClient(profile) - omemo_session = client._xep_0384_session + try: + omemo_session = client._xep_0384_session + except AttributeError: + yield client._xep_0384_ready + omemo_session = client._xep_0384_session entity = itemsEvent.sender devices = self.parseDevices(itemsEvent.items)