Add a send_message() function for plugins

This commit is contained in:
Florent Le Coz 2011-09-25 21:15:00 +02:00
parent c80022e816
commit 47c052acf4

View file

@ -1637,3 +1637,13 @@ class Core(object):
if not self.running or self.background is True: if not self.running or self.background is True:
return return
curses.doupdate() 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