parent
200069062e
commit
0cf86f5a8f
2 changed files with 23 additions and 4 deletions
|
@ -389,7 +389,7 @@ class Contacts:
|
||||||
return tag
|
return tag
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_metacontact(self, brother_account, brother_jid, account, jid):
|
def add_metacontact(self, brother_account, brother_jid, account, jid, order=None):
|
||||||
tag = self.get_metacontacts_tag(brother_account, brother_jid)
|
tag = self.get_metacontacts_tag(brother_account, brother_jid)
|
||||||
if not tag:
|
if not tag:
|
||||||
tag = self.get_new_metacontacts_tag(brother_jid)
|
tag = self.get_new_metacontacts_tag(brother_jid)
|
||||||
|
@ -406,8 +406,12 @@ class Contacts:
|
||||||
if tag not in self._metacontacts_tags[account]:
|
if tag not in self._metacontacts_tags[account]:
|
||||||
self._metacontacts_tags[account][tag] = [{'jid': jid, 'tag': tag}]
|
self._metacontacts_tags[account][tag] = [{'jid': jid, 'tag': tag}]
|
||||||
else:
|
else:
|
||||||
self._metacontacts_tags[account][tag].append({'jid': jid,
|
if order:
|
||||||
'tag': tag})
|
self._metacontacts_tags[account][tag].append({'jid': jid,
|
||||||
|
'tag': tag, 'order': order})
|
||||||
|
else:
|
||||||
|
self._metacontacts_tags[account][tag].append({'jid': jid,
|
||||||
|
'tag': tag})
|
||||||
common.gajim.connections[account].store_metacontacts(
|
common.gajim.connections[account].store_metacontacts(
|
||||||
self._metacontacts_tags[account])
|
self._metacontacts_tags[account])
|
||||||
|
|
||||||
|
@ -510,6 +514,10 @@ class Contacts:
|
||||||
return 1
|
return 1
|
||||||
if data1['order'] < data2['order']:
|
if data1['order'] < data2['order']:
|
||||||
return -1
|
return -1
|
||||||
|
if 'order' in data1:
|
||||||
|
return 1
|
||||||
|
if 'order' in data2:
|
||||||
|
return -1
|
||||||
transport1 = common.gajim.get_transport_name_from_jid(jid1)
|
transport1 = common.gajim.get_transport_name_from_jid(jid1)
|
||||||
transport2 = common.gajim.get_transport_name_from_jid(jid2)
|
transport2 = common.gajim.get_transport_name_from_jid(jid2)
|
||||||
if transport2 and not transport1:
|
if transport2 and not transport1:
|
||||||
|
|
|
@ -3759,6 +3759,7 @@ class RosterWindow:
|
||||||
'So those information will not be saved on next reconnection.'))
|
'So those information will not be saved on next reconnection.'))
|
||||||
|
|
||||||
def merge_contacts(is_checked=None):
|
def merge_contacts(is_checked=None):
|
||||||
|
contacts = 0
|
||||||
if is_checked is not None: # dialog has been shown
|
if is_checked is not None: # dialog has been shown
|
||||||
if is_checked: # user does not want to be asked again
|
if is_checked: # user does not want to be asked again
|
||||||
gajim.config.set('confirm_metacontacts', 'no')
|
gajim.config.set('confirm_metacontacts', 'no')
|
||||||
|
@ -3771,6 +3772,16 @@ class RosterWindow:
|
||||||
c_dest.jid)
|
c_dest.jid)
|
||||||
if dest_family:
|
if dest_family:
|
||||||
self._remove_metacontact_family(dest_family, account_dest)
|
self._remove_metacontact_family(dest_family, account_dest)
|
||||||
|
source_family = gajim.contacts.get_metacontacts_family(account_source, c_source.jid)
|
||||||
|
if dest_family == source_family:
|
||||||
|
n = contacts = len(dest_family)
|
||||||
|
for tag in source_family:
|
||||||
|
if tag['jid'] == c_source.jid:
|
||||||
|
tag['order'] = contacts
|
||||||
|
continue
|
||||||
|
if 'order' in tag:
|
||||||
|
n -= 1
|
||||||
|
tag['order'] = n
|
||||||
else:
|
else:
|
||||||
self._remove_entity(c_dest, account_dest)
|
self._remove_entity(c_dest, account_dest)
|
||||||
|
|
||||||
|
@ -3806,7 +3817,7 @@ class RosterWindow:
|
||||||
|
|
||||||
_contact.groups = c_dest.groups[:]
|
_contact.groups = c_dest.groups[:]
|
||||||
gajim.contacts.add_metacontact(account_dest, c_dest.jid,
|
gajim.contacts.add_metacontact(account_dest, c_dest.jid,
|
||||||
_account, _contact.jid)
|
_account, _contact.jid, contacts)
|
||||||
gajim.connections[account_source].update_contact(_contact.jid,
|
gajim.connections[account_source].update_contact(_contact.jid,
|
||||||
_contact.name, _contact.groups)
|
_contact.name, _contact.groups)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue