comparison src/plugins/plugin_misc_text_commands.py @ 697:0c84fb112d70

core: sendMessage triggers now use a treatments deferred; - treaments deferred can be used by plugins to change XML elements before sending them, in a similar way as for newMessage - sendMessageXml trigger became useless, so it as been removed in favor of the new deferred
author Goffi <goffi@goffi.org>
date Wed, 13 Nov 2013 13:57:36 +0100
parents 84a6e83157c2
children d731ae066158
comparison
equal deleted inserted replaced
696:f1a2831d549d 697:0c84fb112d70
40 def __init__(self, host): 40 def __init__(self, host):
41 info(_("Text commands initialization")) 41 info(_("Text commands initialization"))
42 self.host = host 42 self.host = host
43 host.trigger.add("sendMessage", self.sendMessageTrigger) 43 host.trigger.add("sendMessage", self.sendMessageTrigger)
44 44
45 def sendMessageTrigger(self, mess_data, profile): 45 def sendMessageTrigger(self, mess_data, treatments, profile):
46 """ Check text commands in message, and react consequently """ 46 """ Check text commands in message, and react consequently """
47 msg = mess_data["message"] 47 msg = mess_data["message"]
48 if msg: 48 if msg:
49 if msg[0] == '/': 49 if msg[0] == '/':
50 command = msg[1:].partition(' ')[0].lower() 50 command = msg[1:].partition(' ')[0].lower()