From f1cbf0659ec040a3a8c468c988f3d89247080047 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 11 Aug 2018 18:24:55 +0200 Subject: [PATCH] core (xmpp): send initial presence only after all profileConnected have been treated: presence is now sent after profileConnected methods are done, this avoid to have to deal with synchronisation in connection event. For instance, PEP events should not be sent before presence is sent, so profileConnected methods can assume PEP events are not done yet, and do needed initialisation using async method if necessary. This has been done to avoid overcomplicated synchronisation in XEP-0384 plugin (network calls are needed to initialise session, but PEP events need an initialised session to be treated). --- sat/core/xmpp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index 9a143b34..41ba5bf6 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -196,6 +196,9 @@ class SatXMPPEntity(object): ) # FIXME: we should have a timeout here, and a way to know if a plugin freeze # TODO: mesure launch time of each plugin + # we finally send our presence + entity.presence.available() + def getConnectionDeferred(self): """Return a deferred which fire when the client is connected""" return self.conn_deferred @@ -678,7 +681,6 @@ class SatXMPPClient(SatXMPPEntity, wokkel_client.XMPPClient): def _finish_connection(self, __): self.roster.requestRoster() - self.presence.available() super(SatXMPPClient, self)._finish_connection(__)