changeset 2915:d1fcb8e9aced

core: fixed component connexion: presence announcement has been moved to startConnection, but component don't have presence. This patch fixes it by moving presence announcement to clients only.
author Goffi <goffi@goffi.org>
date Sun, 14 Apr 2019 08:21:51 +0200
parents 25f14fbd364e
children 0b9faea5cb58
files sat/core/xmpp.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/xmpp.py	Sun Apr 14 08:21:51 2019 +0200
+++ b/sat/core/xmpp.py	Sun Apr 14 08:21:51 2019 +0200
@@ -222,9 +222,6 @@
         )  # 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 _disconnectionCb(self, __):
         self._connected_d = None
 
@@ -748,6 +745,14 @@
         self.presence = SatPresenceProtocol(self.host_app)
         self.presence.setHandlerParent(self)
 
+    @classmethod
+    @defer.inlineCallbacks
+    def startConnection(cls, host, profile, max_retries):
+        yield super(SatXMPPClient, cls).startConnection(host, profile, max_retries)
+        entity = host.profiles[profile]
+        # we finally send our presence
+        entity.presence.available()
+
     def entityConnected(self):
         # we want to be sure that we got the roster
         return self.roster.got_roster