From 103ddd762d7ed98ce263604de9979002e3ca47b3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 14:51:48 +0100 Subject: Updated plugin doc --- doc/en/plugins.txt | 56 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) (limited to 'doc/en') diff --git a/doc/en/plugins.txt b/doc/en/plugins.txt index 706a7e50..079e258b 100644 --- a/doc/en/plugins.txt +++ b/doc/en/plugins.txt @@ -94,7 +94,53 @@ CAUTION: TODO [[events-list]] Events list ----------- -CAUTION: TODO + +SleekXMPP events +~~~~~~~~~~~~~~~~ + +For the sleekxmpp events, please refer to the https://github.com/fritzy/SleekXMPP/wiki/Event-Index[sleekxmpp event index]. + + +Poezio events +~~~~~~~~~~~~~ + +*muc_say*:: +message+, +tab+ + +The handlers for this event are called whenever you say something in a MUC (through the /say command or by direct input). The parameters given to the handlers anre: + +* _message_: Message to be sent +* _tab_: Tab in which the message will be sent + +*private_say*:: +message+, +tab+ + +The handlers for this event are called whenever you say something in a private conversaton in a MUC (through the /say command or by direct input). The parameters given to the handlers are: + +* _message_: Message to be sent +* _tab_: Tab in which the message will be sent + +*conversation_say*:: +message+, +tab+ + +The handlers for this event are called whenever you say something in direct conversation (through the /say command or by direct input). The parameters given to the handler are: + +* _message_: Message to be sent +* _tab_: Tab in which the message will be sent + +*muc_msg*:: +message+, +tab+ + +The handlers for this event are called whenever you receive a message in a MUC. The parameters given to the handler are: + +* _message_: Message received +* _tab_: Tab in which the message was received + +*private_msg*:: +message+, +tab+ + +The handlers for this event are called whenever you receive a message in a private conversation in a MUC. The parameters given to the handler are: + +* _message_: Message received +* _tab_: Tab in which the message was received + +*conversation_msg*:: +message+, +tab+ + +The handlers for this event are called whenever you receive a message in a direct conversation. The parameters given to the handler are: + +* _message_: Message received +* _tab_: Tab in which the message was received + +CAUTION: Plugins are in an experimental state and this API might change slightly in a near future. You have to be aware of that while making a plugin. Examples -------- @@ -108,7 +154,7 @@ class Plugin(BasePlugin): def init(self): self.add_command('hello', self.command_hello, "Usage: /hello\nHello: Send 'Hello World!'", None) - def command_hello(self, args): + def command_hello(self, arg): self.core.send_message('Hello World!') --------------- ===================================================================== @@ -121,11 +167,11 @@ class Plugin(BasePlugin): --------------- class Plugin(BasePlugin): def init(self): - self.add_event_handler('groupchat_message', self.on_groupchat_message) + self.add_event_handler('muc_msg', self.on_groupchat_message) - def on_groupchat_message(self, message): + def on_groupchat_message(self, message, tab): if message['mucnick'] == "Partauche": - self.core.send_message('tg', to=message.getMucroom()) + tab.command_say('tg') --------------- ===================================================================== -- cgit v1.2.3