core: contact deletion from roster if we have no subscription to it (behaviour may change in futur)

quick frontend: groups is updated in contactList in case of roster push
This commit is contained in:
Goffi 2011-05-29 16:12:08 +02:00
commit 279f173624
2 changed files with 17 additions and 3 deletions

View file

@ -475,7 +475,6 @@ class SAT(service.Service):
to_jid=jid.JID(to)
self.profiles[profile].roster.removeItem(to_jid)
self.profiles[profile].presence.unsubscribe(to_jid)
self.bridge.contactDeleted(to, profile)
## callbacks ##

View file

@ -158,6 +158,12 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
def onRosterSet(self, item):
"""Called when a new/update roster item is received"""
#TODO: send a signal to frontends
if not item.subscriptionTo and not item.subscriptionFrom and not item.ask:
#XXX: current behaviour: we don't want contact in our roster list
#if there is no presence subscription
#may change in the future
self.removeItem(item.jid)
return
item_attr = {'to': str(item.subscriptionTo),
'from': str(item.subscriptionFrom),
'ask': str(item.ask)
@ -171,9 +177,9 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
def onRosterRemove(self, entity):
"""Called when a roster removal event is received"""
#TODO: send a signal to frontends
print _("removing %s from roster list") % entity.full()
self.host.memory.delContact(entity, self.parent.profile)
self.host.bridge.contactDeleted(entity.userhost(), self.parent.profile)
def getGroups(self):
"""Return a set of groups"""