# HG changeset patch # User Goffi # Date 1306678328 -7200 # Node ID ea3e1b82dd794a7fc6912ba987a1c6690c10009c # Parent ca3a041fed30f556c91211545a70c9bcf12aa10c 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 diff -r ca3a041fed30 -r ea3e1b82dd79 frontends/src/quick_frontend/quick_app.py --- a/frontends/src/quick_frontend/quick_app.py Sat May 28 20:28:21 2011 +0200 +++ b/frontends/src/quick_frontend/quick_app.py Sun May 29 16:12:08 2011 +0200 @@ -203,7 +203,11 @@ if not self.check_profile(profile): return entity=JID(JabberId) - self.rosterList[entity.short]=(dict(attributes), list(groups)) + _groups = list(groups) + self.rosterList[entity.short]=(dict(attributes), _groups) + if entity in self.CM: + self.CM.update(entity, 'groups', _groups) + self.contactList.replace(entity, self.CM.getAttr(entity, 'groups')) def newMessage(self, from_jid, msg, type, to_jid, profile): if not self.check_profile(profile): diff -r ca3a041fed30 -r ea3e1b82dd79 frontends/src/quick_frontend/quick_contact_management.py --- a/frontends/src/quick_frontend/quick_contact_management.py Sat May 28 20:28:21 2011 +0200 +++ b/frontends/src/quick_frontend/quick_contact_management.py Sun May 29 16:12:08 2011 +0200 @@ -31,6 +31,9 @@ def __init__(self): self.__contactlist = {} + def __contains__(self, entity): + return entity.short in self.__contactlist + def clear(self): """Clear all the contact list""" self.__contactlist.clear() @@ -39,6 +42,8 @@ """Add contact to the list, update resources""" if not self.__contactlist.has_key(entity.short): self.__contactlist[entity.short] = {'resources':[]} + if not entity.resource: + return if entity.resource in self.__contactlist[entity.short]['resources']: self.__contactlist[entity.short]['resources'].remove(entity.resource) self.__contactlist[entity.short]['resources'].append(entity.resource) diff -r ca3a041fed30 -r ea3e1b82dd79 src/core/sat_main.py --- a/src/core/sat_main.py Sat May 28 20:28:21 2011 +0200 +++ b/src/core/sat_main.py Sun May 29 16:12:08 2011 +0200 @@ -475,7 +475,6 @@ 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 ## diff -r ca3a041fed30 -r ea3e1b82dd79 src/core/xmpp.py --- a/src/core/xmpp.py Sat May 28 20:28:21 2011 +0200 +++ b/src/core/xmpp.py Sun May 29 16:12:08 2011 +0200 @@ -158,6 +158,12 @@ 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 @@ 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"""