summaryrefslogtreecommitdiff
path: root/src/tabs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs')
-rw-r--r--src/tabs/conversationtab.py28
-rw-r--r--src/tabs/muctab.py7
-rw-r--r--src/tabs/xmltab.py17
3 files changed, 38 insertions, 14 deletions
diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py
index a6cb0d59..cc9e6b2e 100644
--- a/src/tabs/conversationtab.py
+++ b/src/tabs/conversationtab.py
@@ -385,11 +385,15 @@ class DynamicConversationTab(ConversationTab):
assert(resource)
if resource != self.locked_resource:
self.locked_resource = resource
-
- message = _('\x19%s}Conversation locked to %s/%s.') % (
- dump_tuple(get_theme().COLOR_INFORMATION_TEXT),
- self.name,
- resource)
+ info = '\x19%s}' % dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
+ jid_c = '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID)
+
+ message = _('%(info)sConversation locked to '
+ '%(jid_c)s%(jid)s/%(resource)s%(info)s.') % {
+ 'info': info,
+ 'jid_c': jid_c,
+ 'jid': self.name,
+ 'resource': resource}
self.add_message(message, typ=0)
self.check_features()
@@ -405,16 +409,18 @@ class DynamicConversationTab(ConversationTab):
self.remote_wants_chatstates = None
if self.locked_resource != None:
self.locked_resource = None
+ info = '\x19%s}' % dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
+ jid_c = '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID)
if from_:
- message = _('\x19%s}Conversation unlocked '
- '(received activity from %s).') % (
- dump_tuple(get_theme().COLOR_INFORMATION_TEXT),
- from_)
+ message = _('%(info)sConversation unlocked (received activity'
+ ' from %(jid_c)s%(jid)s%(info)s).') % {
+ 'info': info,
+ 'jid_c': jid_c,
+ 'jid': from_}
self.add_message(message, typ=0)
else:
- message = _('\x19%s}Conversation unlocked.') % (
- dump_tuple(get_theme().COLOR_INFORMATION_TEXT))
+ message = _('%sConversation unlocked.') % info
self.add_message(message, typ=0)
def get_dest_jid(self):
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index 5ebaf522..f526ec80 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -355,7 +355,8 @@ class MucTab(ChatTab):
dump_tuple(theme.color_role(user.role)),
user.role or 'None',
'\n%s' % user.status if user.status else '')
- self.core.information(info, 'Info')
+ self.add_message(info, typ=0)
+ self.core.refresh_window()
def command_configure(self, arg):
"""
@@ -1525,11 +1526,11 @@ class MucTab(ChatTab):
config.get_by_tabname('notify_messages',
True, self.name)):
self.state = 'message'
- if time:
+ if time and not txt.startswith('/me'):
txt = '\x19%(info_col)s}%(txt)s' % {
'txt': txt,
'info_col': dump_tuple(get_theme().COLOR_LOG_MSG)}
- elif (not nickname or time) and not txt.startswith('/me '):
+ elif not nickname:
txt = '\x19%(info_col)s}%(txt)s' % {
'txt': txt,
'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}
diff --git a/src/tabs/xmltab.py b/src/tabs/xmltab.py
index 7cbc9fb6..083e97c5 100644
--- a/src/tabs/xmltab.py
+++ b/src/tabs/xmltab.py
@@ -11,12 +11,14 @@ import logging
log = logging.getLogger(__name__)
import curses
+import os
from slixmpp.xmlstream import matcher
from slixmpp.xmlstream.handler import Callback
from . import Tab
import windows
+from xhtml import clean_text
class XMLTab(Tab):
def __init__(self):
@@ -45,6 +47,10 @@ class XMLTab(Tab):
usage=_('<xml mask>'),
desc=_('Show only the stanzas matching the given xml mask.'),
shortdesc=_('Filter by xml mask.'))
+ self.register_command('dump', self.command_dump,
+ usage=_('<filename>'),
+ desc=_('Writes the content of the XML buffer into a file.'),
+ shortdesc=_('Write in a file.'))
self.input = self.default_help_message
self.key_func['^T'] = self.close
self.key_func['^I'] = self.completion
@@ -111,6 +117,17 @@ class XMLTab(Tab):
self.filter = ''
self.refresh()
+ def command_dump(self, arg):
+ """/dump <filename>"""
+ xml = self.core.xml_buffer.messages[:]
+ text = '\n'.join(('%s %s' % (msg.str_time, clean_text(msg.txt)) for msg in xml))
+ filename = os.path.expandvars(os.path.expanduser(arg))
+ try:
+ with open(filename, 'w') as fd:
+ fd.write(text)
+ except Exception as e:
+ self.core.information('Could not write the XML dump: %s' % e, 'Error')
+
def on_slash(self):
"""
'/' is pressed, activate the input