summaryrefslogtreecommitdiff
path: root/sleekxmpp/clientxmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-06 23:30:14 -0500
committerLance Stout <lancestout@gmail.com>2012-01-06 23:30:14 -0500
commit8ef7188dae21f9ddde40365cdff8e046d7b4678a (patch)
tree742d97c0dd46c2bf38e10d3f9dc12d66c3dcad76 /sleekxmpp/clientxmpp.py
parent8fd2efa2fa50751af7b5182ad7793295c540d294 (diff)
downloadslixmpp-8ef7188dae21f9ddde40365cdff8e046d7b4678a.tar.gz
slixmpp-8ef7188dae21f9ddde40365cdff8e046d7b4678a.tar.bz2
slixmpp-8ef7188dae21f9ddde40365cdff8e046d7b4678a.tar.xz
slixmpp-8ef7188dae21f9ddde40365cdff8e046d7b4678a.zip
Fix client_roster when the bare JID changes after binding.
Adds session_bind event.
Diffstat (limited to 'sleekxmpp/clientxmpp.py')
-rw-r--r--sleekxmpp/clientxmpp.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index 20012b5f..e3d210ae 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -97,6 +97,7 @@ class ClientXMPP(BaseXMPP):
self.bindfail = False
self.add_event_handler('connected', self._handle_connected)
+ self.add_event_handler('session_bind', self._handle_session_bind)
self.register_stanza(StreamFeatures)
@@ -288,6 +289,14 @@ class ClientXMPP(BaseXMPP):
iq.send()
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.
# Deprecated method names are re-mapped for backwards compatibility.