Mercurial > libervia-backend
comparison sat/core/xmpp.py @ 2661:661f66d41215
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).
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 11 Aug 2018 18:24:55 +0200 |
parents | 4e130cc9bfc0 |
children | e9cd473a2f46 |
comparison
equal
deleted
inserted
replaced
2660:2901e22d1766 | 2661:661f66d41215 |
---|---|
193 | 193 |
194 yield list_d.addCallback( | 194 yield list_d.addCallback( |
195 logPluginResults | 195 logPluginResults |
196 ) # FIXME: we should have a timeout here, and a way to know if a plugin freeze | 196 ) # FIXME: we should have a timeout here, and a way to know if a plugin freeze |
197 # TODO: mesure launch time of each plugin | 197 # TODO: mesure launch time of each plugin |
198 | |
199 # we finally send our presence | |
200 entity.presence.available() | |
198 | 201 |
199 def getConnectionDeferred(self): | 202 def getConnectionDeferred(self): |
200 """Return a deferred which fire when the client is connected""" | 203 """Return a deferred which fire when the client is connected""" |
201 return self.conn_deferred | 204 return self.conn_deferred |
202 | 205 |
676 profile=self.profile, | 679 profile=self.profile, |
677 ) | 680 ) |
678 | 681 |
679 def _finish_connection(self, __): | 682 def _finish_connection(self, __): |
680 self.roster.requestRoster() | 683 self.roster.requestRoster() |
681 self.presence.available() | |
682 super(SatXMPPClient, self)._finish_connection(__) | 684 super(SatXMPPClient, self)._finish_connection(__) |
683 | 685 |
684 | 686 |
685 class SatXMPPComponent(SatXMPPEntity, component.Component): | 687 class SatXMPPComponent(SatXMPPEntity, component.Component): |
686 """XMPP component | 688 """XMPP component |