fix strimg comparison according to locales. Fixes #4201
This commit is contained in:
		
							parent
							
								
									e3dbbed2dd
								
							
						
					
					
						commit
						478454985b
					
				
					 2 changed files with 14 additions and 17 deletions
				
			
		|  | @ -29,6 +29,7 @@ | |||
| 
 | ||||
| import os | ||||
| import time | ||||
| import locale | ||||
| import gtk | ||||
| import pango | ||||
| import gobject | ||||
|  | @ -394,9 +395,7 @@ class GroupchatControl(ChatControlBase): | |||
| 		nick1 = nick1.decode('utf-8') | ||||
| 		nick2 = nick2.decode('utf-8') | ||||
| 		if type1 == 'role': | ||||
| 			if nick1 < nick2: | ||||
| 				return -1 | ||||
| 			return 1 | ||||
| 			return locale.strcoll(nick1, nick2) | ||||
| 		if type1 == 'contact': | ||||
| 			gc_contact1 = gajim.contacts.get_gc_contact(self.account, | ||||
| 				self.room_jid, nick1) | ||||
|  | @ -420,11 +419,7 @@ class GroupchatControl(ChatControlBase): | |||
| 		# We compare names | ||||
| 		name1 = gc_contact1.get_shown_name() | ||||
| 		name2 = gc_contact2.get_shown_name() | ||||
| 		if name1.lower() < name2.lower(): | ||||
| 			return -1 | ||||
| 		if name2.lower() < name1.lower(): | ||||
| 			return 1 | ||||
| 		return 0 | ||||
| 		return locale.strcoll(name1.lower(), name2.lower()) | ||||
| 
 | ||||
| 	def on_msg_textview_populate_popup(self, textview, menu): | ||||
| 		'''we override the default context menu and we prepend Clear | ||||
|  |  | |||
|  | @ -38,6 +38,7 @@ import gobject | |||
| import os | ||||
| import sys | ||||
| import time | ||||
| import locale | ||||
| 
 | ||||
| import common.sleepy | ||||
| import history_window | ||||
|  | @ -1558,9 +1559,7 @@ class RosterWindow: | |||
| 		account1 = account1.decode('utf-8') | ||||
| 		account2 = account2.decode('utf-8') | ||||
| 		if type1 == 'account': | ||||
| 			if account1 < account2: | ||||
| 				return -1 | ||||
| 			return 1 | ||||
| 			return locale.strcoll(account1, account2) | ||||
| 		jid1 = model[iter1][C_JID].decode('utf-8') | ||||
| 		jid2 = model[iter2][C_JID].decode('utf-8') | ||||
| 		if type1 == 'contact': | ||||
|  | @ -1607,20 +1606,23 @@ class RosterWindow: | |||
| 			elif show1 > show2: | ||||
| 				return 1 | ||||
| 		# We compare names | ||||
| 		if name1.lower() < name2.lower(): | ||||
| 		cmp_result = locale.strcoll(name1.lower(), name2.lower()) | ||||
| 		if cmp_result < 0: | ||||
| 			return -1 | ||||
| 		if name2.lower() < name1.lower(): | ||||
| 		if cmp_result > 0: | ||||
| 			return 1 | ||||
| 		if type1 == 'contact' and type2 == 'contact': | ||||
| 			# We compare account names | ||||
| 			if account1.lower() < account2.lower(): | ||||
| 			cmp_result = locale.strcoll(account1.lower(), account2.lower()) | ||||
| 			if cmp_result < 0: | ||||
| 				return -1 | ||||
| 			if account2.lower() < account1.lower(): | ||||
| 			if cmp_result > 0: | ||||
| 				return 1 | ||||
| 			# We compare jids | ||||
| 			if jid1.lower() < jid2.lower(): | ||||
| 			cmp_result = locale.strcoll(jid1.lower(), jid2.lower()) | ||||
| 			if cmp_result < 0: | ||||
| 				return -1 | ||||
| 			if jid2.lower() < jid1.lower(): | ||||
| 			if cmp_result > 0: | ||||
| 				return 1 | ||||
| 		return 0 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue