summaryrefslogtreecommitdiff
path: root/src/tabs/basetabs.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-11-25 16:58:26 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-11-25 17:07:45 +0100
commite1808a8455aadc9fac300c68e397b712a030ae29 (patch)
treedf5ad7cf84a8e9faa4cd018189bf585ee9d7bdeb /src/tabs/basetabs.py
parent61b5c6a91e58b81811bcbf8e789b0bf112d3a416 (diff)
downloadpoezio-e1808a8455aadc9fac300c68e397b712a030ae29.tar.gz
poezio-e1808a8455aadc9fac300c68e397b712a030ae29.tar.bz2
poezio-e1808a8455aadc9fac300c68e397b712a030ae29.tar.xz
poezio-e1808a8455aadc9fac300c68e397b712a030ae29.zip
Parse command arguments using a decorator and make things more consistent
Avoid surprises with some commands accepting quoted arguments and some other not. fix #2555
Diffstat (limited to 'src/tabs/basetabs.py')
-rw-r--r--src/tabs/basetabs.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py
index 0a55640c..9c74c239 100644
--- a/src/tabs/basetabs.py
+++ b/src/tabs/basetabs.py
@@ -35,7 +35,7 @@ from decorators import refresh_wrapper
from logger import logger
from text_buffer import TextBuffer
from theming import get_theme, dump_tuple
-
+from decorators import command_args_parser
# getters for tab colors (lambdas, so that they are dynamic)
STATE_COLORS = {
@@ -544,11 +544,12 @@ class ChatTab(Tab):
self.command_say(xhtml.convert_simple_to_full_colors(txt))
self.cancel_paused_delay()
- def command_xhtml(self, arg):
+ @command_args_parser.raw
+ def command_xhtml(self, xhtml):
""""
/xhtml <custom xhtml>
"""
- message = self.generate_xhtml_message(arg)
+ message = self.generate_xhtml_message(xhtml)
if message:
message.send()
@@ -573,7 +574,7 @@ class ChatTab(Tab):
return self.name
@refresh_wrapper.always
- def command_clear(self, args):
+ def command_clear(self, ignored):
"""
/clear
"""
@@ -637,6 +638,7 @@ class ChatTab(Tab):
self.core.remove_timed_event(self.timed_event_paused)
self.timed_event_paused = None
+ @command_args_parser.raw
def command_correct(self, line):
"""
/correct <fixed message>
@@ -672,6 +674,7 @@ class ChatTab(Tab):
if self.text_win.pos != 0:
self.state = 'scrolled'
+ @command_args_parser.raw
def command_say(self, line, correct=False):
pass
@@ -728,8 +731,9 @@ class OneToOneTab(ChatTab):
jid=self.get_dest_jid(), timeout=5,
callback=self.features_checked)
- def command_attention(self, message=''):
- "/attention [message]"
+ @command_args_parser.raw
+ def command_attention(self, message):
+ """/attention [message]"""
if message is not '':
self.command_say(message, attention=True)
else:
@@ -738,6 +742,7 @@ class OneToOneTab(ChatTab):
msg['attention'] = True
msg.send()
+ @command_args_parser.raw
def command_say(self, line, correct=False, attention=False):
pass