Commit [8446] again: WorksForMe. See #3335.

This commit is contained in:
Stephan Erb 2007-08-20 19:17:32 +00:00
parent 194829e805
commit c41732c6ab
2 changed files with 21 additions and 8 deletions

View File

@ -280,6 +280,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 \
@ -373,6 +377,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 = {}

View File

@ -4715,6 +4715,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)
@ -4735,7 +4736,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')
@ -4927,13 +4931,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 \