Fix client_roster when the bare JID changes after binding.
Adds session_bind event.
This commit is contained in:
parent
8fd2efa2fa
commit
8ef7188dae
2 changed files with 10 additions and 0 deletions
|
@ -97,6 +97,7 @@ class ClientXMPP(BaseXMPP):
|
||||||
self.bindfail = False
|
self.bindfail = False
|
||||||
|
|
||||||
self.add_event_handler('connected', self._handle_connected)
|
self.add_event_handler('connected', self._handle_connected)
|
||||||
|
self.add_event_handler('session_bind', self._handle_session_bind)
|
||||||
|
|
||||||
self.register_stanza(StreamFeatures)
|
self.register_stanza(StreamFeatures)
|
||||||
|
|
||||||
|
@ -288,6 +289,14 @@ class ClientXMPP(BaseXMPP):
|
||||||
iq.send()
|
iq.send()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _handle_session_bind(self, jid):
|
||||||
|
"""Set the client roster to the JID set by the server.
|
||||||
|
|
||||||
|
:param :class:`sleekxmpp.xmlstream.jid.JID` jid: The bound JID as
|
||||||
|
dictated by the server. The same as :attr:`boundjid`.
|
||||||
|
"""
|
||||||
|
self.client_roster = self.roster[jid]
|
||||||
|
|
||||||
|
|
||||||
# To comply with PEP8, method names now use underscores.
|
# To comply with PEP8, method names now use underscores.
|
||||||
# Deprecated method names are re-mapped for backwards compatibility.
|
# Deprecated method names are re-mapped for backwards compatibility.
|
||||||
|
|
|
@ -52,6 +52,7 @@ class feature_bind(base_plugin):
|
||||||
|
|
||||||
self.xmpp.set_jid(response['bind']['jid'])
|
self.xmpp.set_jid(response['bind']['jid'])
|
||||||
self.xmpp.bound = True
|
self.xmpp.bound = True
|
||||||
|
self.xmpp.event('session_bind', self.xmpp.boundjid, direct=True)
|
||||||
|
|
||||||
self.xmpp.features.add('bind')
|
self.xmpp.features.add('bind')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue