when 2 contacts have the same name we compare account name and then jid so we are sure of the order
This commit is contained in:
parent
5c456141c8
commit
e71989dfa0
|
@ -2357,8 +2357,6 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
return 1
|
return 1
|
||||||
if name2 == _('not in the roster'):
|
if name2 == _('not in the roster'):
|
||||||
return -1
|
return -1
|
||||||
if type1 == 'contact' and type2 == 'contact' and \
|
|
||||||
gajim.config.get('sort_by_show'):
|
|
||||||
account1 = model[iter1][C_ACCOUNT]
|
account1 = model[iter1][C_ACCOUNT]
|
||||||
account2 = model[iter2][C_ACCOUNT]
|
account2 = model[iter2][C_ACCOUNT]
|
||||||
if account1 and account2:
|
if account1 and account2:
|
||||||
|
@ -2366,6 +2364,9 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
account2 = account2.decode('utf-8')
|
account2 = account2.decode('utf-8')
|
||||||
jid1 = model[iter1][C_JID].decode('utf-8')
|
jid1 = model[iter1][C_JID].decode('utf-8')
|
||||||
jid2 = model[iter2][C_JID].decode('utf-8')
|
jid2 = model[iter2][C_JID].decode('utf-8')
|
||||||
|
# We first compare by show if sort_by_show is True
|
||||||
|
if type1 == 'contact' and type2 == 'contact' and \
|
||||||
|
gajim.config.get('sort_by_show'):
|
||||||
luser1 = gajim.contacts[account1][jid1]
|
luser1 = gajim.contacts[account1][jid1]
|
||||||
luser2 = gajim.contacts[account2][jid2]
|
luser2 = gajim.contacts[account2][jid2]
|
||||||
cshow = {'online':0, 'chat': 1, 'away': 2, 'xa': 3, 'dnd': 4,
|
cshow = {'online':0, 'chat': 1, 'away': 2, 'xa': 3, 'dnd': 4,
|
||||||
|
@ -2384,10 +2385,22 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
return -1
|
return -1
|
||||||
elif show1 > show2:
|
elif show1 > show2:
|
||||||
return 1
|
return 1
|
||||||
|
# We compare names
|
||||||
if name1.lower() < name2.lower():
|
if name1.lower() < name2.lower():
|
||||||
return -1
|
return -1
|
||||||
if name2.lower() < name1.lower():
|
if name2.lower() < name1.lower():
|
||||||
return 1
|
return 1
|
||||||
|
if type1 == 'contact' and type2 == 'contact':
|
||||||
|
# We compare account names
|
||||||
|
if account1.lower() < account2.lower():
|
||||||
|
return -1
|
||||||
|
if account2.lower() < account1.lower():
|
||||||
|
return 1
|
||||||
|
# We compare jids
|
||||||
|
if jid1.lower() < jid2.lower():
|
||||||
|
return -1
|
||||||
|
if jid2.lower() < jid1.lower():
|
||||||
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def drag_data_get_data(self, treeview, context, selection, target_id, etime):
|
def drag_data_get_data(self, treeview, context, selection, target_id, etime):
|
||||||
|
|
Loading…
Reference in New Issue