comparison src/plugins/plugin_misc_text_commands.py @ 922:c897c8d321b3

core: sendMessageTrigger now manage pre and post treatments, which happen before or after XML generation
author Goffi <goffi@goffi.org>
date Sat, 22 Mar 2014 15:34:05 +0100
parents 8dd168c7741c
children d609581bf74a
comparison
equal deleted inserted replaced
921:8dd168c7741c 922:c897c8d321b3
44 def __init__(self, host): 44 def __init__(self, host):
45 info(_("Text commands initialization")) 45 info(_("Text commands initialization"))
46 self.host = host 46 self.host = host
47 host.trigger.add("sendMessage", self.sendMessageTrigger) 47 host.trigger.add("sendMessage", self.sendMessageTrigger)
48 48
49 def sendMessageTrigger(self, mess_data, treatments, profile): 49 def sendMessageTrigger(self, mess_data, pre_xml_treatments, post_xml_treatments, profile):
50 """ Install SendMessage command hook """ 50 """ Install SendMessage command hook """
51 treatments.addCallback(self._sendMessageCmdHook, profile) 51 pre_xml_treatments.addCallback(self._sendMessageCmdHook, profile)
52 return True 52 return True
53 53
54 def _sendMessageCmdHook(self, mess_data, profile): 54 def _sendMessageCmdHook(self, mess_data, profile):
55 """ Check text commands in message, and react consequently 55 """ Check text commands in message, and react consequently
56 msg starting with / are potential command. If a command is found, it is executed, else message is sent normally 56 msg starting with / are potential command. If a command is found, it is executed, else message is sent normally