diff options
author | Lance Stout <lancestout@gmail.com> | 2012-07-19 23:54:18 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-07-19 23:54:18 -0700 |
commit | 917faecdcbf07b63173b34b708cff5bdf6476d25 (patch) | |
tree | 3a456b4ffa3de085fbad0312eaf27d4147af29eb /sleekxmpp/roster/multi.py | |
parent | f6edaa56a6e91f7104cd63e5d48b39d4ca7e09f2 (diff) | |
download | slixmpp-917faecdcbf07b63173b34b708cff5bdf6476d25.tar.gz slixmpp-917faecdcbf07b63173b34b708cff5bdf6476d25.tar.bz2 slixmpp-917faecdcbf07b63173b34b708cff5bdf6476d25.tar.xz slixmpp-917faecdcbf07b63173b34b708cff5bdf6476d25.zip |
Fix issue of roster data being split across multiple rosters.
Resolved by always normalizing JIDs to bare form, regardless of if they
are JID objects or strings.
Also simplified related code to prefer use of JID objects instead of
strings so they don't need to be parsed multiple times.
Diffstat (limited to 'sleekxmpp/roster/multi.py')
-rw-r--r-- | sleekxmpp/roster/multi.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sleekxmpp/roster/multi.py b/sleekxmpp/roster/multi.py index 9a04aebb..5d070ec8 100644 --- a/sleekxmpp/roster/multi.py +++ b/sleekxmpp/roster/multi.py @@ -94,10 +94,12 @@ class Roster(object): Arguments: key -- Return the roster for this JID. """ - if isinstance(key, JID): - key = key.bare if key is None: - key = self.xmpp.boundjid.bare + key = self.xmpp.boundjid + if not isinstance(key, JID): + key = JID(key) + key = key.bare + if key not in self._rosters: self.add(key) self._rosters[key].auto_authorize = self.auto_authorize @@ -119,8 +121,10 @@ class Roster(object): Arguments: node -- The JID for the new roster node. """ - if isinstance(node, JID): - node = node.bare + if not isinstance(node, JID): + node = JID(node) + + node = node.bare if node not in self._rosters: self._rosters[node] = RosterNode(self.xmpp, node, self.db) |