summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 5d7f2286..e5df2e7d 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -390,6 +390,9 @@ class ChatTab(Tab):
self.text_win.refresh()
self.input.refresh()
+ def get_conversation_messages(self):
+ return self._text_buffer.messages
+
def command_say(self, line):
raise NotImplementedError
@@ -711,6 +714,10 @@ class MucTab(ChatTab):
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'groupchat'
msg['body'] = line
+ # trigger the event BEFORE looking for colors.
+ # This lets a plugin insert \x19xxx} colors, that will
+ # be converted in xhtml.
+ self.core.events.trigger('muc_say', msg)
if msg['body'].find('\x19') != -1:
msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body'])
msg['body'] = xhtml.clean_text(msg['body'])
@@ -1202,6 +1209,10 @@ class PrivateTab(ChatTab):
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'chat'
msg['body'] = line
+ # trigger the event BEFORE looking for colors.
+ # This lets a plugin insert \x19xxx} colors, that will
+ # be converted in xhtml.
+ self.core.events.trigger('private_say', msg)
self.core.add_message_to_text_buffer(self._text_buffer, msg['body'], None, self.core.own_nick or self.own_nick)
if msg['body'].find('\x19') != -1:
msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body'])
@@ -1397,6 +1408,7 @@ class RosterInfoTab(Tab):
self.commands['remove'] = (self.command_remove, _("Usage: /remove [jid]\nRemove: Use this command to remove the specified JID from your roster. This wil unsubscribe you from its presence, cancel its subscription to yours, and remove the item from your roster"), self.completion_remove)
self.commands['export'] = (self.command_export, _("Usage: /export [/path/to/file]\nExport: Use this command to export your contacts into /path/to/file if specified, or $HOME/poezio_contacts if not."), None)
self.commands['import'] = (self.command_import, _("Usage: /import [/path/to/file]\nImport: Use this command to import your contacts from /path/to/file if specified, or $HOME/poezio_contacts if not."), None)
+ self.commands['clear_infos'] = (self.command_clear_infos, _("Usage: /clear_infos\nClear Infos: Use this command to clear the info buffer."), None)
self.resize()
def resize(self):
@@ -1417,6 +1429,15 @@ class RosterInfoTab(Tab):
not self.input.help_message:
self.complete_commands(self.input)
+ def command_clear_infos(self, arg):
+ """
+ /clear_infos
+ """
+ self.core.information_buffer.messages = []
+ self.information_win.rebuild_everything(self.core.information_buffer)
+ self.core.information_win.rebuild_everything(self.core.information_buffer)
+ self.refresh()
+
def command_deny(self, args):
"""
Denies a JID from our roster
@@ -1864,6 +1885,11 @@ class ConversationTab(ChatTab):
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'chat'
msg['body'] = line
+ # trigger the event BEFORE looking for colors.
+ # and before displaying the message in the window
+ # This lets a plugin insert \x19xxx} colors, that will
+ # be converted in xhtml.
+ self.core.events.trigger('conversation_say', msg)
self.core.add_message_to_text_buffer(self._text_buffer, msg['body'], None, self.core.own_nick)
if msg['body'].find('\x19') != -1:
msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body'])
@@ -1977,6 +2003,9 @@ class ConversationTab(ChatTab):
if config.get('send_chat_states', 'true') == 'true':
self.send_chat_state('gone')
+ def add_message(self, txt, time=None, nickname=None, forced_user=None):
+ self._text_buffer.add_message(txt, time, nickname, None, None, forced_user)
+
class MucListTab(Tab):
"""
A tab listing rooms from a specific server, displaying various information,