diff options
author | mathieui <mathieui@mathieui.net> | 2012-04-18 15:54:52 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-04-18 15:54:52 +0200 |
commit | 384f6939cb09268ebbb3072490b3b0c87bff82ba (patch) | |
tree | 2ae8bb6fe80cf3fe559a3e3199222bd6c665d6e0 /src/tabs.py | |
parent | 6b01e714623b6d7c1c60c98019c52633b2788250 (diff) | |
download | poezio-384f6939cb09268ebbb3072490b3b0c87bff82ba.tar.gz poezio-384f6939cb09268ebbb3072490b3b0c87bff82ba.tar.bz2 poezio-384f6939cb09268ebbb3072490b3b0c87bff82ba.tar.xz poezio-384f6939cb09268ebbb3072490b3b0c87bff82ba.zip |
Add a get_nick method to the tabs
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tabs.py b/src/tabs.py index fce2bade..66af43b5 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -269,6 +269,12 @@ class Tab(object): """ return self.__class__.__name__ + def get_nick(self): + """ + Get the nick of the tab (defaults to its name) + """ + return self.get_name() + def get_text_window(self): """ Returns the principal TextWin window, if there's one @@ -1086,6 +1092,11 @@ class MucTab(ChatTab): def get_name(self): return self.name + def get_nick(self): + if config.getl('show_muc_jid', 'true') == 'false': + return JID(self.name).user + return self.name + def get_text_window(self): return self.text_win @@ -1585,6 +1596,9 @@ class PrivateTab(ChatTab): def get_name(self): return self.name + def get_nick(self): + return JID(self.name).resource + def on_input(self, key, raw): if not raw and key in self.key_func: self.key_func[key]() @@ -2350,6 +2364,10 @@ class ConversationTab(ChatTab): def get_name(self): return self.name + def get_nick(self): + jid = JID(self.name) + return roster.get_contact_by_jid(jid.bare).name or jid.user + def on_input(self, key, raw): if not raw and key in self.key_func: self.key_func[key]() |