summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core.py8
-rw-r--r--src/tabs.py14
2 files changed, 17 insertions, 5 deletions
diff --git a/src/core.py b/src/core.py
index c330bbde..f4f355e6 100644
--- a/src/core.py
+++ b/src/core.py
@@ -1652,10 +1652,16 @@ class Core(object):
return
self.current_tab_nb = nb
else:
+ matchs = []
for tab in self.tabs:
for name in tab.matching_names():
- if nb in name:
+ if nb.lower() in name[1].lower():
+ matchs.append((name[0], tab))
self.current_tab_nb = tab.nb
+ if not matchs:
+ return
+ tab = min(matchs, key=lambda m: m[0])[1]
+ self.current_tab_nb = tab.nb
old_tab.on_lose_focus()
self.current_tab().on_gain_focus()
self.refresh_window()
diff --git a/src/tabs.py b/src/tabs.py
index f619cc12..639f4c77 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1825,7 +1825,7 @@ class MucTab(ChatTab):
return False
def matching_names(self):
- return [safeJID(self.get_name()).user]
+ return [(1, safeJID(self.get_name()).user), (3, self.get_name())]
class PrivateTab(ChatTab):
"""
@@ -2115,7 +2115,7 @@ class PrivateTab(ChatTab):
self.add_message(txt=reason, typ=2)
def matching_names(self):
- return [safeJID(self.get_name()).resource]
+ return [(3, safeJID(self.get_name()).resource), (4, self.get_name())]
class RosterInfoTab(Tab):
"""
@@ -3342,10 +3342,13 @@ class ConversationTab(ChatTab):
self.send_chat_state('gone')
def matching_names(self):
+ res = []
+ jid = safeJID(self.get_name())
+ res.append((2, jid.bare))
+ res.append((1, jid.user))
contact = roster[self.get_name()]
- res = [contact.bare_jid if contact else safeJID(self.get_name()).bare]
if contact and contact.name:
- res.append(contact.name)
+ res.append((0, contact.name))
return res
class DynamicConversationTab(ConversationTab):
@@ -3602,6 +3605,9 @@ class MucListTab(Tab):
self.listview.refresh()
self.core.doupdate()
+ def matching_names(self):
+ return [(2, self.name)]
+
class XMLTab(Tab):
def __init__(self):
Tab.__init__(self)