summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2012-12-15 19:51:07 +0100
committerFlorent Le Coz <louiz@louiz.org>2012-12-15 19:51:07 +0100
commit266ba884e50b550122fefb568888fb5d1f91fba7 (patch)
treec5010fe95763c09017aa10ed0aa1dd852b98a873 /src/tabs.py
parent4fe00ed0693340b4b76b563f6015120de25e2fe6 (diff)
downloadpoezio-266ba884e50b550122fefb568888fb5d1f91fba7.tar.gz
poezio-266ba884e50b550122fefb568888fb5d1f91fba7.tar.bz2
poezio-266ba884e50b550122fefb568888fb5d1f91fba7.tar.xz
poezio-266ba884e50b550122fefb568888fb5d1f91fba7.zip
Make /w command better.
fix #2185
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/tabs.py b/src/tabs.py
index f604eca2..c9c5d153 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -366,6 +366,15 @@ class Tab(object):
if self.input:
self.input.on_delete()
+ def matching_names(self):
+ """
+ Returns a list of strings that are used to name a tab with the /win
+ command. For example you could switch to a tab that returns
+ ['hello', 'coucou'] using /win hel, or /win coucou
+ If not implemented in the tab, it just doesn’t match with anything.
+ """
+ return []
+
def __del__(self):
log.debug('------ Closing tab %s', self.__class__.__name__)
@@ -1632,6 +1641,9 @@ class MucTab(ChatTab):
self._text_buffer.add_message(txt, time, nickname, nick_color, history, user, highlight=highlight, identifier=identifier)
return highlight
+ def matching_names(self):
+ return [safeJID(self.get_name()).user]
+
class PrivateTab(ChatTab):
"""
The tab containg a private conversation (someone from a MUC)
@@ -1900,6 +1912,9 @@ class PrivateTab(ChatTab):
user=forced_user,
identifier=identifier)
+ def matching_names(self):
+ return [safeJID(self.get_name()).resource]
+
class RosterInfoTab(Tab):
"""
A tab, splitted in two, containing the roster and infos
@@ -2972,6 +2987,12 @@ class ConversationTab(ChatTab):
user=forced_user,
identifier=identifier)
+ def matching_names(self):
+ 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)
+ return res
class MucListTab(Tab):
"""
@@ -3143,7 +3164,6 @@ class MucListTab(Tab):
self.core.doupdate()
class XMLTab(Tab):
-
def __init__(self):
Tab.__init__(self)
self.state = 'normal'