don't propose to add contacts we already have in our roster when we get a RIE request.

This commit is contained in:
Yann Leboulanger 2009-11-19 22:13:16 +01:00
parent d664daad1a
commit 8720eb221d
1 changed files with 15 additions and 1 deletions

View File

@ -1860,9 +1860,23 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
log.warn('Invalid JID: %s, ignoring it' % item.getAttr('jid'))
continue
name = item.getAttr('name')
groups=[]
contact = gajim.contact.get_contact(self.name, jid)
groups = []
same_groups = True
for group in item.getTags('group'):
groups.append(group.getData())
# check that all suggested groups are in the groups we have for this
# contact
if not contact or group not in contact.groups:
same_groups = False
if contact:
# check that all groups we have for this contact are in the
# suggested groups
for group in contact.groups:
if group not in groups:
same_groups = False
if contact.subscription in ('both', 'to') and same_groups:
continue
exchange_items_list[jid] = []
exchange_items_list[jid].append(name)
exchange_items_list[jid].append(groups)