comparison sat/core/xmpp.py @ 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 f6b0088ce247
children f44a95f566d2
comparison
equal deleted inserted replaced
2914:25f14fbd364e 2915:d1fcb8e9aced
219 219
220 yield list_d.addCallback( 220 yield list_d.addCallback(
221 logPluginResults 221 logPluginResults
222 ) # FIXME: we should have a timeout here, and a way to know if a plugin freeze 222 ) # FIXME: we should have a timeout here, and a way to know if a plugin freeze
223 # TODO: mesure launch time of each plugin 223 # TODO: mesure launch time of each plugin
224
225 # we finally send our presence
226 entity.presence.available()
227 224
228 def _disconnectionCb(self, __): 225 def _disconnectionCb(self, __):
229 self._connected_d = None 226 self._connected_d = None
230 227
231 def _disconnectionEb(self, failure_): 228 def _disconnectionEb(self, failure_):
746 self.roster.setHandlerParent(self) 743 self.roster.setHandlerParent(self)
747 744
748 self.presence = SatPresenceProtocol(self.host_app) 745 self.presence = SatPresenceProtocol(self.host_app)
749 self.presence.setHandlerParent(self) 746 self.presence.setHandlerParent(self)
750 747
748 @classmethod
749 @defer.inlineCallbacks
750 def startConnection(cls, host, profile, max_retries):
751 yield super(SatXMPPClient, cls).startConnection(host, profile, max_retries)
752 entity = host.profiles[profile]
753 # we finally send our presence
754 entity.presence.available()
755
751 def entityConnected(self): 756 def entityConnected(self):
752 # we want to be sure that we got the roster 757 # we want to be sure that we got the roster
753 return self.roster.got_roster 758 return self.roster.got_roster
754 759
755 def addPostXmlCallbacks(self, post_xml_treatments): 760 def addPostXmlCallbacks(self, post_xml_treatments):