comparison src/core/xmpp.py @ 875:19d7d077478a

core (xmpp): fix automatic contact deletion
author souliane <souliane@mailoo.org>
date Tue, 25 Feb 2014 18:47:15 +0100
parents 9e3641ea648f
children e77948faaef3
comparison
equal deleted inserted replaced
874:1f5ad976fa32 875:19d7d077478a
171 """ ask the server for Roster list """ 171 """ ask the server for Roster list """
172 debug("requestRoster") 172 debug("requestRoster")
173 d = self.getRoster().addCallback(self.rosterCb) 173 d = self.getRoster().addCallback(self.rosterCb)
174 d.chainDeferred(self.got_roster) 174 d.chainDeferred(self.got_roster)
175 175
176 def removeItem(self, to): 176 def removeItem(self, to_jid):
177 """Remove a contact from roster list""" 177 """Remove a contact from roster list
178 xmppim.RosterClientProtocol.removeItem(self, to) 178 @param to_jid: a JID instance
179 """
180 xmppim.RosterClientProtocol.removeItem(self, to_jid)
179 #TODO: check IQ result 181 #TODO: check IQ result
180 182
181 #XXX: disabled (cf http://wokkel.ik.nu/ticket/56)) 183 #XXX: disabled (cf http://wokkel.ik.nu/ticket/56))
182 #def addItem(self, to): 184 #def addItem(self, to):
183 #"""Add a contact to roster list""" 185 #"""Add a contact to roster list"""
381 def unsubscribeReceived(self, entity): 383 def unsubscribeReceived(self, entity):
382 debug(_("unsubscription asked for [%s]") % entity.userhost()) 384 debug(_("unsubscription asked for [%s]") % entity.userhost())
383 item = self.parent.roster.getItem(entity) 385 item = self.parent.roster.getItem(entity)
384 if item and item.subscriptionFrom: # we automatically remove contact 386 if item and item.subscriptionFrom: # we automatically remove contact
385 debug(_('automatic contact deletion')) 387 debug(_('automatic contact deletion'))
386 self.host.delContact(entity.userhost(), self.parent.profile) 388 self.host.delContact(entity, self.parent.profile)
387 self.host.bridge.subscribe('unsubscribe', entity.userhost(), self.parent.profile) 389 self.host.bridge.subscribe('unsubscribe', entity.userhost(), self.parent.profile)
388 390
389 391
390 class SatDiscoProtocol(disco.DiscoClientProtocol): 392 class SatDiscoProtocol(disco.DiscoClientProtocol):
391 def __init__(self, host): 393 def __init__(self, host):