From 6505d57f38419aa436fbd51e0f7d98c3fc00b2a1 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 1 Mar 2006 18:58:28 +0000 Subject: [PATCH] some check in meta contacts. See #1627 --- src/common/contacts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/contacts.py b/src/common/contacts.py index 9be2859a5..eec1f6c08 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -218,16 +218,20 @@ class Contacts: return None def define_meta_contacts(self, account, children_list): - self._children_meta_contacts[account] = children_list self._parent_meta_contacts[account] = {} for parent_jid in children_list: + parent_list = self._children_meta_contacts[account][parent_jid] = [] for children_jid in children_list[parent_jid]: + if not children_jid in parent_list[parent_jid]: + parent_list[parent_jid].append(children_jid) self._parent_meta_contacts[account][children_jid] = parent_jid def add_subcontact(self, account, parent_jid, child_jid): self._parent_meta_contacts[account][child_jid] = parent_jid if self._children_meta_contacts[account].has_key(parent_jid): - self._children_meta_contacts[account][parent_jid].append(child_jid) + list = self._children_meta_contacts[account][parent_jid] + if not child_jid in list: + list.append(child_jid) else: self._children_meta_contacts[account][parent_jid] = [child_jid] common.gajim.connections[account].store_meta_contacts(