summaryrefslogtreecommitdiff
path: root/src/tabs/privatetab.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs/privatetab.py')
-rw-r--r--src/tabs/privatetab.py44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/tabs/privatetab.py b/src/tabs/privatetab.py
index 4c01cd70..a715a922 100644
--- a/src/tabs/privatetab.py
+++ b/src/tabs/privatetab.py
@@ -10,8 +10,6 @@ both participant’s nicks. It also has slightly different features than
the ConversationTab (such as tab-completion on nicks from the room).
"""
-from gettext import gettext as _
-
import logging
log = logging.getLogger(__name__)
@@ -27,6 +25,7 @@ from config import config
from decorators import refresh_wrapper
from logger import logger
from theming import get_theme, dump_tuple
+from decorators import command_args_parser
class PrivateTab(OneToOneTab):
"""
@@ -48,15 +47,15 @@ class PrivateTab(OneToOneTab):
self.key_func['^I'] = self.completion
# commands
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.'))
+ 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.'))
+ shortdesc='Close the tab.')
self.register_command('close', self.command_unquery,
- shortdesc=_('Close the tab.'))
+ 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.'))
+ desc='Get the software version of the current interlocutor (usually its XMPP client and Operating System).',
+ shortdesc='Get the software version of a jid.')
self.resize()
self.parent_muc = self.core.get_tab_by_name(safeJID(name).bare, MucTab)
self.on = True
@@ -87,13 +86,14 @@ class PrivateTab(OneToOneTab):
def load_logs(self, log_nb):
logs = logger.get_logs(safeJID(self.name).full.replace('/', '\\'), log_nb)
+ return logs
def log_message(self, txt, nickname, time=None, typ=1):
"""
Log the messages in the archives.
"""
if not logger.log_message(self.name, nickname, txt, date=time, typ=typ):
- self.core.information(_('Unable to write in the log file'), 'Error')
+ self.core.information('Unable to write in the log file', 'Error')
def on_close(self):
self.parent_muc.privates.remove(self)
@@ -120,6 +120,7 @@ class PrivateTab(OneToOneTab):
empty_after = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//'))
self.send_composing_chat_state(empty_after)
+ @command_args_parser.raw
def command_say(self, line, attention=False, correct=False):
if not self.on:
return
@@ -182,13 +183,15 @@ class PrivateTab(OneToOneTab):
self.text_win.refresh()
self.input.refresh()
- def command_unquery(self, arg):
+ @command_args_parser.ignored
+ def command_unquery(self):
"""
/unquery
"""
self.core.close_tab()
- def command_version(self, arg):
+ @command_args_parser.quoted(0, 1)
+ def command_version(self, args):
"""
/version
"""
@@ -196,22 +199,23 @@ class PrivateTab(OneToOneTab):
if not res:
return self.core.information('Could not get the software version from %s' % (jid,), 'Warning')
version = '%s is running %s version %s on %s' % (jid,
- res.get('name') or _('an unknown software'),
- res.get('version') or _('unknown'),
- res.get('os') or _('an unknown platform'))
+ res.get('name') or 'an unknown software',
+ res.get('version') or 'unknown',
+ res.get('os') or 'an unknown platform')
self.core.information(version, 'Info')
- if arg:
- return self.core.command_version(arg)
+ if args:
+ return self.core.command_version(args[0])
jid = safeJID(self.name)
fixes.get_version(self.core.xmpp, jid,
callback=callback)
+ @command_args_parser.quoted(0, 1)
def command_info(self, arg):
"""
/info
"""
- if arg:
- self.parent_muc.command_info(arg)
+ if arg and arg[0]:
+ self.parent_muc.command_info(arg[0])
else:
user = safeJID(self.name).resource
self.parent_muc.command_info(user)
@@ -319,9 +323,9 @@ class PrivateTab(OneToOneTab):
"""
self.deactivate()
if not status_message:
- self.add_message(_('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room') % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2)
+ self.add_message('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room' % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2)
else:
- self.add_message(_('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room (%(status)s)"') % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'status': status_message, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2)
+ self.add_message('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room (%(status)s)"' % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'status': status_message, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2)
return self.core.current_tab() is self
@refresh_wrapper.conditional