compare rfilter string in unicode rather that in str. Fixes #7300

This commit is contained in:
Yann Leboulanger 2013-02-21 19:03:20 +01:00
parent 2c389640a7
commit 53e46223be

View file

@ -1653,10 +1653,12 @@ class RosterWindow:
if model.iter_has_child(titer): if model.iter_has_child(titer):
iter_c = model.iter_children(titer) iter_c = model.iter_children(titer)
while iter_c: while iter_c:
if self.rfilter_string in model[iter_c][C_NAME].lower(): if self.rfilter_string in model[iter_c][C_NAME].decode(
'utf-8').lower():
return True return True
iter_c = model.iter_next(iter_c) iter_c = model.iter_next(iter_c)
return self.rfilter_string in model[titer][C_NAME].lower() return self.rfilter_string in model[titer][C_NAME].decode(
'utf-8').lower()
if gajim.config.get('showoffline'): if gajim.config.get('showoffline'):
return True return True
bb_jid = None bb_jid = None
@ -1681,7 +1683,8 @@ class RosterWindow:
return self.contact_is_visible(contact, account) return self.contact_is_visible(contact, account)
if type_ == 'agent': if type_ == 'agent':
if self.rfilter_enabled: if self.rfilter_enabled:
return self.rfilter_string in model[titer][C_NAME].lower() return self.rfilter_string in model[titer][C_NAME].decode(
'utf-8').lower()
contact = gajim.contacts.get_contact_with_highest_priority(account, contact = gajim.contacts.get_contact_with_highest_priority(account,
jid) jid)
return self.contact_has_pending_roster_events(contact, account) or \ return self.contact_has_pending_roster_events(contact, account) or \
@ -1689,7 +1692,8 @@ class RosterWindow:
(gajim.account_is_connected(account) or \ (gajim.account_is_connected(account) or \
gajim.config.get('showoffline'))) gajim.config.get('showoffline')))
if type_ == 'groupchat' and self.rfilter_enabled: if type_ == 'groupchat' and self.rfilter_enabled:
return self.rfilter_string in model[titer][C_NAME].lower() return self.rfilter_string in model[titer][C_NAME].decode('utf-8').\
lower()
return True return True
def _compareIters(self, model, iter1, iter2, data=None): def _compareIters(self, model, iter1, iter2, data=None):
@ -4416,7 +4420,7 @@ class RosterWindow:
def on_rfilter_entry_changed(self, widget): def on_rfilter_entry_changed(self, widget):
""" When we update the content of the filter """ """ When we update the content of the filter """
self.rfilter_string = widget.get_text().lower() self.rfilter_string = widget.get_text().decode('utf-8').lower()
if self.rfilter_string == '': if self.rfilter_string == '':
self.disable_rfilter() self.disable_rfilter()
self.refilter_shown_roster_items() self.refilter_shown_roster_items()
@ -4424,7 +4428,7 @@ class RosterWindow:
self.tree.get_selection().unselect_all() self.tree.get_selection().unselect_all()
def _func(model, path, iter_): def _func(model, path, iter_):
if model[iter_][C_TYPE] == 'contact' and self.rfilter_string in \ if model[iter_][C_TYPE] == 'contact' and self.rfilter_string in \
model[iter_][C_NAME].lower(): model[iter_][C_NAME].decode('utf-8').lower():
col = self.tree.get_column(0) col = self.tree.get_column(0)
self.tree.set_cursor_on_cell(path, col) self.tree.set_cursor_on_cell(path, col)
return True return True