core: use of Twisted JID instead of string bare jid in roster SatRosterProtocol

This commit is contained in:
Goffi 2013-12-10 17:25:31 +01:00
commit 2ad1019de7

View file

@ -218,7 +218,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
info(_("new contact in roster list: %s"), item.jid.full())
#self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile)
bare_jid = item.jid.userhost()
bare_jid = item.jid.userhostJID()
self._jids[bare_jid] = item
for group in item.groups:
self._groups.setdefault(group, set()).add(bare_jid)
@ -227,7 +227,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
def onRosterRemove(self, entity):
"""Called when a roster removal event is received"""
print _("removing %s from roster list") % entity.full()
bare_jid = entity.userhost()
bare_jid = entity.userhostJID()
# we first remove item from local cache (self._groups and self._jids)
try:
@ -256,7 +256,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
"""Return RosterItem for a given jid
@param jid: jid of the contact
@return: RosterItem or None if contact is not in cache"""
return self._jids.get(jid.userhost(), None)
return self._jids.get(jid.userhostJID(), None)
def getBareJids(self):
"""Return all bare jids (as unicode) of the roster"""
@ -264,7 +264,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
def isJidInRoster(self, entity_jid):
"""Return True if jid is in roster"""
return entity_jid.userhost() in self._jids
return entity_jid.userhostJID() in self._jids
def getItems(self):
"""Return all items of the roster"""