From a3dfd55e049d289ff8086878eadcea4f8e258502 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 15 May 2017 22:41:18 +0100 Subject: Merge /unquery and /close into OneToOneTab. --- poezio/tabs/basetabs.py | 11 +++++++++++ poezio/tabs/conversationtab.py | 8 -------- poezio/tabs/privatetab.py | 11 ----------- 3 files changed, 11 insertions(+), 19 deletions(-) (limited to 'poezio') diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 2f6be22b..f4c4cf0a 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -709,6 +709,10 @@ class OneToOneTab(ChatTab): self.remote_supports_attention = True self.remote_supports_receipts = True self.check_features() + self.register_command('unquery', self.command_unquery, + shortdesc='Close the tab.') + self.register_command('close', self.command_unquery, + shortdesc='Close the tab.') def remote_user_color(self): return dump_tuple(get_theme().COLOR_REMOTE_USER) @@ -816,6 +820,13 @@ class OneToOneTab(ChatTab): def command_say(self, line, correct=False, attention=False): pass + @command_args_parser.ignored + def command_unquery(self): + """ + /unquery + """ + self.core.close_tab(self) + def missing_command_callback(self, command_name): if command_name not in ('correct', 'attention'): return False diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 461d8fae..5c309672 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -51,10 +51,6 @@ class ConversationTab(OneToOneTab): # keys self.key_func['^I'] = self.completion # commands - self.register_command('unquery', self.command_unquery, - shortdesc='Close the tab.') - self.register_command('close', self.command_unquery, - shortdesc='Close the tab.') self.register_command('version', self.command_version, desc='Get the software version of the current interlocutor (usually its XMPP client and Operating System).', shortdesc='Get the software version of the user.') @@ -205,10 +201,6 @@ class ConversationTab(OneToOneTab): self._text_buffer.add_message("\x19%(info_col)s}No information available\x19o" % {'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}) return True - @command_args_parser.ignored - def command_unquery(self): - self.core.close_tab(self) - @command_args_parser.quoted(0, 1) def command_version(self, args): """ diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index b6c19f1a..9279929a 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -49,10 +49,6 @@ class PrivateTab(OneToOneTab): self.register_command('info', self.command_info, desc='Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.', shortdesc='Info about the user.') - self.register_command('unquery', self.command_unquery, - shortdesc='Close the tab.') - self.register_command('close', self.command_unquery, - shortdesc='Close the tab.') self.register_command('version', self.command_version, desc='Get the software version of the current interlocutor (usually its XMPP client and Operating System).', shortdesc='Get the software version of a jid.') @@ -190,13 +186,6 @@ class PrivateTab(OneToOneTab): self.text_win.refresh() self.input.refresh() - @command_args_parser.ignored - def command_unquery(self): - """ - /unquery - """ - self.core.close_tab(self) - @command_args_parser.quoted(0, 1) def command_version(self, args): """ -- cgit v1.2.3