From 47c052acf47848a35987c6c41d9c20d390894f3e Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 25 Sep 2011 21:15:00 +0200 Subject: [PATCH] Add a send_message() function for plugins --- src/core.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core.py b/src/core.py index 88c926a9..1f60e252 100644 --- a/src/core.py +++ b/src/core.py @@ -1637,3 +1637,13 @@ class Core(object): if not self.running or self.background is True: return curses.doupdate() + + def send_message(self, msg): + """ + Function to use in plugins to send a message in the current conversation. + Returns False if the current tab is not a conversation tab + """ + if not isinstance(self.current_tab(), tabs.ChatTab): + return False + self.current_tab().command_say(msg) + return True