From 8e436c58cd2d2d914b93521263007d31e171ec18 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 5 Feb 2007 22:18:33 +0000 Subject: Added event handler to plugin API --- doc/de/weechat.de.xml | 285 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 284 insertions(+), 1 deletion(-) (limited to 'doc/de') diff --git a/doc/de/weechat.de.xml b/doc/de/weechat.de.xml index 470821124..37d1e1f74 100644 --- a/doc/de/weechat.de.xml +++ b/doc/de/weechat.de.xml @@ -2511,6 +2511,121 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb); + +
+ event_handler_add + + + Prototype: + + t_plugin_handler *event_handler_add (t_weechat_plugin + *plugin, char *event, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add an event handler, called when an event happens. + + + Arguments: + + + + : pointer to plugin structure + + + + + : event, see table below: + + + + + Event + Description + + + + + buffer_open + a buffer was open + + + buffer_close + a buffer was closed + + + + + + + + + : function called + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Argument argc is set to 1, argv[0] is number of buffer + open/closed. + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new event handler. + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + + Example: + +int my_event (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, NULL, NULL, "my_event"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *event_handler; +event_handler = plugin->event_handler_add (plugin, "buffer_open", + &my_event); + + +
+
handler_remove @@ -2887,6 +3002,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello"); server Name des Servers + + type + + Puffertyp: 0=standard, 1=DCC, 2=raw IRC data + + away Status des "away"-Flags @@ -4270,7 +4391,7 @@ else int type - Puffertyp: 0=standard, 1=dcc, 2=raw IRC data + Puffertyp: 0=standard, 1=DCC, 2=raw IRC data int @@ -5664,6 +5785,106 @@ end
+ +
+ add_event_handler + + + Perl prototype: + + weechat::add_event_handler(event, function); + + + + Python prototype: + + weechat.add_event_handler(event, function) + + + + Ruby prototype: + + Weechat.add_event_handler(event, function) + + + + Lua prototype: + + weechat.add_event_handler(event, function) + + + + Add an event handler, called when an event happens. + + + Arguments: + + + + : event + (see ) + + + + + : function called + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_event_handler("buffer_open", "my_event"); +sub my_event +{ + weechat::print("buffer open"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_event_handler("buffer_open", "my_event") +def my_event(): + weechat.prnt("buffer open") + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_event_handler("buffer_open", "my_event") +def my_event() + Weechat.print("buffer open") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_event_handler("buffer_open", "my_event") +function my_event() + weechat.print("buffer open") + return weechat.PLUGIN_RC_OK() +end + + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + +
+
remove_handler @@ -5852,6 +6073,68 @@ weechat.remove_keyboard_handler("my_keyboard")
+ +
+ remove_event_handler + + + Perl prototype: + + weechat::remove_event_handler(function); + + + + Python prototype: + + weechat.remove_event_handler(function) + + + + Ruby prototype: + + Weechat.remove_event_handler(function) + + + + Lua prototype: + + weechat.remove_event_handler(function) + + + + Remove an event handler. + + + Arguments: + + + + : function + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_event_handler("my_event"); + +# python +weechat.remove_event_handler("my_event") + +# ruby +Weechat.remove_event_handler("my_event") + +-- lua +weechat.remove_event_handler("my_event") + + +
+
add_modifier -- cgit v1.2.3