diff options
author | mathieui <mathieui@mathieui.net> | 2013-06-13 01:00:53 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-06-13 01:00:53 +0200 |
commit | 833faa4f370f26f2b2296114da27473d2cb6bfb5 (patch) | |
tree | 882c3aa12cc95e9f2b7afa04a0b26da121b02c9e /src/tabs.py | |
parent | 2b4c06b6f81f46e9f712882877fdd261aae84065 (diff) | |
download | poezio-833faa4f370f26f2b2296114da27473d2cb6bfb5.tar.gz poezio-833faa4f370f26f2b2296114da27473d2cb6bfb5.tar.bz2 poezio-833faa4f370f26f2b2296114da27473d2cb6bfb5.tar.xz poezio-833faa4f370f26f2b2296114da27473d2cb6bfb5.zip |
Improve the roster search
- now case-insensitive
- search in the bare jid instead of userpart only (and still in roster
names)
- do not display groups when searching
- display offline contacts
- do not expand resources if they were before the search
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tabs.py b/src/tabs.py index c0a34f29..fb6b393b 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -3012,6 +3012,8 @@ class RosterInfoTab(Tab): self.input = windows.CommandInput("[Search]", self.on_search_terminate, self.on_search_terminate, self.set_roster_filter) self.input.resize(1, self.width, self.height-1, 0) self.input.disable_history() + roster.modified() + self.refresh() return True @refresh_wrapper.always @@ -3024,11 +3026,13 @@ class RosterInfoTab(Tab): def set_roster_filter_slow(self, txt): roster.contact_filter = (jid_and_name_match_slow, txt) + roster.modified() self.refresh() return False def set_roster_filter(self, txt): roster.contact_filter = (jid_and_name_match, txt) + roster.modified() self.refresh() return False @@ -3037,6 +3041,7 @@ class RosterInfoTab(Tab): curses.curs_set(0) roster.contact_filter = None self.reset_help_message() + roster.modified() return False def on_close(self): @@ -3851,12 +3856,12 @@ def jid_and_name_match(contact, txt): """ Match jid with text precisely """ - roster.modified() if not txt: return True - if txt in safeJID(contact.bare_jid).user: + txt = txt.lower() + if txt in safeJID(contact.bare_jid).bare.lower(): return True - if txt in contact.name: + if txt in contact.name.lower(): return True return False @@ -3865,10 +3870,9 @@ def jid_and_name_match_slow(contact, txt): A function used to know if a contact in the roster should be shown in the roster """ - roster.modified() if not txt: return True # Everything matches when search is empty - user = safeJID(contact.bare_jid).user + user = safeJID(contact.bare_jid).bare if diffmatch(txt, user): return True if contact.name and diffmatch(txt, contact.name): |