comparison src/core/xmpp.py @ 347:ea3e1b82dd79

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
author Goffi <goffi@goffi.org>
date Sun, 29 May 2011 16:12:08 +0200
parents ca3a041fed30
children adcc41e4d6ea
comparison
equal deleted inserted replaced
346:ca3a041fed30 347:ea3e1b82dd79
156 return iq.send() 156 return iq.send()
157 157
158 def onRosterSet(self, item): 158 def onRosterSet(self, item):
159 """Called when a new/update roster item is received""" 159 """Called when a new/update roster item is received"""
160 #TODO: send a signal to frontends 160 #TODO: send a signal to frontends
161 if not item.subscriptionTo and not item.subscriptionFrom and not item.ask:
162 #XXX: current behaviour: we don't want contact in our roster list
163 #if there is no presence subscription
164 #may change in the future
165 self.removeItem(item.jid)
166 return
161 item_attr = {'to': str(item.subscriptionTo), 167 item_attr = {'to': str(item.subscriptionTo),
162 'from': str(item.subscriptionFrom), 168 'from': str(item.subscriptionFrom),
163 'ask': str(item.ask) 169 'ask': str(item.ask)
164 } 170 }
165 if item.name: 171 if item.name:
169 self.host.bridge.newContact(item.jid.full(), item_attr, item.groups, self.parent.profile) 175 self.host.bridge.newContact(item.jid.full(), item_attr, item.groups, self.parent.profile)
170 self._groups.update(item.groups) 176 self._groups.update(item.groups)
171 177
172 def onRosterRemove(self, entity): 178 def onRosterRemove(self, entity):
173 """Called when a roster removal event is received""" 179 """Called when a roster removal event is received"""
174 #TODO: send a signal to frontends
175 print _("removing %s from roster list") % entity.full() 180 print _("removing %s from roster list") % entity.full()
176 self.host.memory.delContact(entity, self.parent.profile) 181 self.host.memory.delContact(entity, self.parent.profile)
182 self.host.bridge.contactDeleted(entity.userhost(), self.parent.profile)
177 183
178 def getGroups(self): 184 def getGroups(self):
179 """Return a set of groups""" 185 """Return a set of groups"""
180 return self._groups 186 return self._groups
181 187