diff --git a/src/common/contacts.py b/src/common/contacts.py index 52cb81959..17c9309d9 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -277,6 +277,10 @@ class Contacts: for account in accounts: our_jid = common.gajim.get_jid_from_account(account) for jid in self.get_jid_list(account): + if self.has_brother(account, jid) and not \ + self.is_big_brother(account, jid): + # count metacontacts only once + continue if jid == our_jid: continue if common.gajim.jid_is_transport(jid) and not \ @@ -370,6 +374,17 @@ class Contacts: return True return False + def is_big_brother(self, account, jid): + tag = self.get_metacontacts_tag(account, jid) + if tag: + family = self.get_metacontacts_family(account, jid) + bb_data = self.get_metacontacts_big_brother(family) + bb_jid = bb_data['jid'] + bb_account = bb_data['account'] + if bb_jid == jid and bb_account == account: + return True + return False + def get_metacontacts_jids(self, tag): '''Returns all jid for the given tag in the form {acct: [jid1, jid2],.}''' answers = {} diff --git a/src/roster_window.py b/src/roster_window.py index c58aeebe7..6ad5837a1 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -4713,6 +4713,7 @@ class RosterWindow: # remove the source row self.remove_contact(c_source, account_source) # brother inherite big brother groups + old_groups = c_source.groups c_source.groups = [] for g in c_dest.groups: c_source.groups.append(g) @@ -4733,7 +4734,10 @@ class RosterWindow: self.draw_contact(_jid, _account) self.add_contact_to_roster(c_source.jid, account_source) self.draw_contact(c_dest.jid, account_dest) - + # FIXME: Why do groups have to be redrawn by hand? + for g in old_groups: + self.draw_group(g, account_source) + context.finish(True, True, etime) confirm_metacontacts = gajim.config.get('confirm_metacontacts') @@ -4925,13 +4929,7 @@ class RosterWindow: return # Is the contact we drag a meta contact? - is_meta_contact = False - is_big_brother = False - tag = gajim.contacts.get_metacontacts_tag(account_source, jid_source) - if tag: - is_meta_contact = True - if model.iter_has_child(iter_source): - is_big_brother = True + is_big_brother = gajim.contacts.is_big_brother(account_source, jid_source) # Contact drop on group row or between two contacts if type_dest == 'group' or position == gtk.TREE_VIEW_DROP_BEFORE or \