Author: asterix Date: 2009-02-11 18:55:00 +0100 (Wed, 11 Feb 2009) New Revision: 11076
Modified: trunk/src/common/contacts.py trunk/src/roster_window.py Log: [Dicson] Fix meta contact order by DND. Fixes #4797, #4779
Modified: trunk/src/common/contacts.py =================================================================== --- trunk/src/common/contacts.py 2009-02-11 10:58:57 UTC (rev 11075) +++ trunk/src/common/contacts.py 2009-02-11 17:55:00 UTC (rev 11076) @@ -389,7 +389,7 @@ return tag 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) if not tag: tag = self.get_new_metacontacts_tag(brother_jid) @@ -406,8 +406,12 @@ if tag not in self._metacontacts_tags[account]: self._metacontacts_tags[account][tag] = [{'jid': jid, 'tag': tag}] else: - self._metacontacts_tags[account][tag].append({'jid': jid, - 'tag': tag}) + if order: + 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( self._metacontacts_tags[account])
@@ -510,6 +514,10 @@ return 1 if data1['order'] < data2['order']: return -1 + if 'order' in data1: + return 1 + if 'order' in data2: + return -1 transport1 = common.gajim.get_transport_name_from_jid(jid1) transport2 = common.gajim.get_transport_name_from_jid(jid2) if transport2 and not transport1:
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2009-02-11 10:58:57 UTC (rev 11075) +++ trunk/src/roster_window.py 2009-02-11 17:55:00 UTC (rev 11076) @@ -3759,6 +3759,7 @@ 'So those information will not be saved on next reconnection.'))
def merge_contacts(is_checked=None): + contacts = 0 if is_checked is not None: # dialog has been shown if is_checked: # user does not want to be asked again gajim.config.set('confirm_metacontacts', 'no') @@ -3771,6 +3772,16 @@ c_dest.jid) if dest_family: 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: self._remove_entity(c_dest, account_dest)
@@ -3806,7 +3817,7 @@
_contact.groups = c_dest.groups[:] gajim.contacts.add_metacontact(account_dest, c_dest.jid, - _account, _contact.jid) + _account, _contact.jid, contacts) gajim.connections[account_source].update_contact(_contact.jid, _contact.name, _contact.groups)