1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 16:23:14 +02:00

Added timer handler for plugins

This commit is contained in:
Sebastien Helleu
2006-02-19 10:43:47 +00:00
parent 484274d65f
commit 3a213f38ec
38 changed files with 4520 additions and 1980 deletions
+16
View File
@@ -277,6 +277,22 @@ weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
return NULL;
}
/*
* weechat_plugin_timer_handler_add: add a timer handler
*/
t_plugin_handler *
weechat_plugin_timer_handler_add (t_weechat_plugin *plugin, int interval,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && (interval >= 1) && handler_func)
return plugin_timer_handler_add (plugin, interval, handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_plugin_handler_remove: remove a WeeChat handler
*/
+105
View File
@@ -199,6 +199,9 @@ plugin_msg_handler_add (t_weechat_plugin *plugin, char *irc_command,
new_handler->description = NULL;
new_handler->arguments = NULL;
new_handler->arguments_description = NULL;
new_handler->completion_template = NULL;
new_handler->interval = 0;
new_handler->remaining = 0;
new_handler->handler = handler_func;
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
new_handler->handler_pointer = handler_pointer;
@@ -270,6 +273,8 @@ plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
new_handler->arguments = (arguments) ? strdup (arguments) : NULL;
new_handler->arguments_description = (arguments_description) ? strdup (arguments_description) : NULL;
new_handler->completion_template = (completion_template) ? strdup (completion_template) : NULL;
new_handler->interval = 0;
new_handler->remaining = 0;
new_handler->handler = handler_func;
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
new_handler->handler_pointer = handler_pointer;
@@ -299,6 +304,62 @@ plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
return new_handler;
}
/*
* plugin_timer_handler_add: add a timer handler
* arguments:
* 1. the plugin pointer
* 2. the interval between two calls
* 3. the handler function
* 4. handler args: a string given to
* handler when called (used by scripts)
* 5. handler pointer: a pointer given to
* handler when called (used by scripts)
*/
t_plugin_handler *
plugin_timer_handler_add (t_weechat_plugin *plugin, int interval,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
t_plugin_handler *new_handler;
new_handler = (t_plugin_handler *)malloc (sizeof (t_plugin_handler));
if (new_handler)
{
new_handler->type = HANDLER_TIMER;
new_handler->irc_command = NULL;
new_handler->command = NULL;
new_handler->description = NULL;
new_handler->arguments = NULL;
new_handler->arguments_description = NULL;
new_handler->completion_template = NULL;
new_handler->interval = interval;
new_handler->remaining = interval;
new_handler->handler = handler_func;
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
new_handler->handler_pointer = handler_pointer;
new_handler->running = 0;
/* add new handler to list */
new_handler->prev_handler = plugin->last_handler;
new_handler->next_handler = NULL;
if (plugin->handlers)
(plugin->last_handler)->next_handler = new_handler;
else
plugin->handlers = new_handler;
plugin->last_handler = new_handler;
}
else
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s plugin %s: unable to add timer handler (not enough memory)\n"),
WEECHAT_ERROR, plugin->name);
return NULL;
}
return new_handler;
}
/*
* plugin_msg_handler_exec: execute a message handler
* return: code for informing WeeChat whether message
@@ -390,6 +451,49 @@ plugin_cmd_handler_exec (char *server, char *command, char *arguments)
return -1;
}
/*
* plugin_timer_handler_exec: check timer handlers and execute functions if needed
* return: PLUGIN_RC_OK if all ok
* PLUGIN_RC_KO if at least one handler failed
*/
int
plugin_timer_handler_exec ()
{
t_weechat_plugin *ptr_plugin;
t_plugin_handler *ptr_handler;
int return_code, final_return_code;
final_return_code = PLUGIN_RC_OK;
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
for (ptr_handler = ptr_plugin->handlers;
ptr_handler; ptr_handler = ptr_handler->next_handler)
{
if (ptr_handler->type == HANDLER_TIMER)
{
ptr_handler->remaining--;
if (ptr_handler->remaining <= 0)
{
return_code = ((int) (ptr_handler->handler) (ptr_plugin,
"",
"",
"",
ptr_handler->handler_args,
ptr_handler->handler_pointer));
ptr_handler->remaining = ptr_handler->interval;
if (return_code == PLUGIN_RC_KO)
final_return_code = PLUGIN_RC_KO;
}
}
}
}
return final_return_code;
}
/*
* plugin_handler_remove: remove a handler for a plugin
*/
@@ -621,6 +725,7 @@ plugin_load (char *filename)
new_plugin->exec_on_files = &weechat_plugin_exec_on_files;
new_plugin->msg_handler_add = &weechat_plugin_msg_handler_add;
new_plugin->cmd_handler_add = &weechat_plugin_cmd_handler_add;
new_plugin->timer_handler_add = &weechat_plugin_timer_handler_add;
new_plugin->handler_remove = &weechat_plugin_handler_remove;
new_plugin->handler_remove_all = &weechat_plugin_handler_remove_all;
new_plugin->print = &weechat_plugin_print;
+4
View File
@@ -44,8 +44,12 @@ extern t_plugin_handler *plugin_cmd_handler_add (t_weechat_plugin *, char *,
char *,
t_plugin_handler_func *,
char *, void *);
extern t_plugin_handler *plugin_timer_handler_add (t_weechat_plugin *, int,
t_plugin_handler_func *,
char *, void *);
extern int plugin_msg_handler_exec (char *, char *, char *);
extern int plugin_cmd_handler_exec (char *, char *, char *);
extern int plugin_timer_handler_exec ();
extern void plugin_handler_remove (t_weechat_plugin *,
t_plugin_handler *);
extern void plugin_handler_remove_all (t_weechat_plugin *);
+115
View File
@@ -509,6 +509,57 @@ weechat_lua_add_command_handler (lua_State *L)
return 1;
}
/*
* weechat_lua_add_timer_handler: add a timer handler
*/
static int
weechat_lua_add_timer_handler (lua_State *L)
{
int interval;
const char *function;
int n;
/* make gcc happy */
(void) L;
if (!lua_current_script)
{
lua_plugin->print_server (lua_plugin,
"Lua error: unable to add timer handler, "
"script not initialized");
lua_pushnumber (lua_current_interpreter, 0);
return 1;
}
interval = 10;
function = NULL;
n = lua_gettop (lua_current_interpreter);
if (n != 2)
{
lua_plugin->print_server (lua_plugin,
"Lua error: wrong parameters for "
"\"add_timer_handler\" function");
lua_pushnumber (lua_current_interpreter, 0);
return 1;
}
interval = lua_tonumber (lua_current_interpreter, -2);
function = lua_tostring (lua_current_interpreter, -1);
if (!lua_plugin->timer_handler_add (lua_plugin, interval,
weechat_lua_handler, (char *) function,
(void *)lua_current_script))
{
lua_pushnumber (lua_current_interpreter, 0);
return 1;
}
lua_pushnumber (lua_current_interpreter, 1);
return 1;
}
/*
* weechat_lua_remove_handler: remove a handler
*/
@@ -554,6 +605,49 @@ weechat_lua_remove_handler (lua_State *L)
return 1;
}
/*
* weechat_lua_remove_timer_handler: remove a timer handler
*/
static int
weechat_lua_remove_timer_handler (lua_State *L)
{
const char *function;
int n;
/* make gcc happy */
(void) L;
if (!lua_current_script)
{
lua_plugin->print_server (lua_plugin,
"Lua error: unable to remove timer handler, "
"script not initialized");
lua_pushnumber (lua_current_interpreter, 0);
return 1;
}
function = NULL;
n = lua_gettop (lua_current_interpreter);
if (n != 1)
{
lua_plugin->print_server (lua_plugin,
"Lua error: wrong parameters for "
"\"remove_timer_handler\" function");
lua_pushnumber (lua_current_interpreter, 0);
return 1;
}
function = lua_tostring (lua_current_interpreter, -1);
weechat_script_remove_timer_handler (lua_plugin, lua_current_script,
(char *) function);
lua_pushnumber (lua_current_interpreter, 1);
return 1;
}
/*
* weechat_lua_get_info: get various infos
*/
@@ -1275,7 +1369,9 @@ const struct luaL_reg weechat_lua_funcs[] = {
{ "command", weechat_lua_command},
{ "add_message_handler", weechat_lua_add_message_handler},
{ "add_command_handler", weechat_lua_add_command_handler},
{ "add_timer_handler", weechat_lua_add_timer_handler},
{ "remove_handler", weechat_lua_remove_handler},
{ "remove_timer_handler", weechat_lua_remove_timer_handler},
{ "get_info", weechat_lua_get_info},
{ "get_dcc_info", weechat_lua_get_dcc_info},
{ "get_config", weechat_lua_get_config},
@@ -1538,6 +1634,25 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
/* list Lua timer handlers */
plugin->print_server (plugin, "");
plugin->print_server (plugin, "Lua timer handlers:");
handler_found = 0;
for (ptr_handler = plugin->handlers;
ptr_handler; ptr_handler = ptr_handler->next_handler)
{
if ((ptr_handler->type == HANDLER_MESSAGE)
&& (ptr_handler->handler_args))
{
handler_found = 1;
plugin->print_server (plugin, " %d seconds => Lua(%s)",
ptr_handler->interval,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
break;
+102 -1
View File
@@ -522,7 +522,50 @@ static XS (XS_weechat_add_command_handler)
}
/*
* weechat::remove_handler: remove a handler
* weechat::add_timer_handler: add timer handler
*/
static XS (XS_weechat_add_timer_handler)
{
int interval;
char *function;
unsigned int integer;
dXSARGS;
/* make gcc happy */
(void) cv;
if (!perl_current_script)
{
perl_plugin->print_server (perl_plugin,
"Perl error: unable to add timer handler, "
"script not initialized");
XSRETURN_NO;
}
if (items < 2)
{
perl_plugin->print_server (perl_plugin,
"Perl error: wrong parameters for "
"\"add_timer_handler\" function");
XSRETURN_NO;
}
interval = SvIV (ST (0));
function = SvPV (ST (1), integer);
perl_plugin->print_server (perl_plugin,
"Perl add timer: interval = %d", interval);
if (perl_plugin->timer_handler_add (perl_plugin, interval,
weechat_perl_handler, function,
(void *)perl_current_script))
XSRETURN_YES;
XSRETURN_NO;
}
/*
* weechat::remove_handler: remove a message/command handler
*/
static XS (XS_weechat_remove_handler)
@@ -559,6 +602,43 @@ static XS (XS_weechat_remove_handler)
XSRETURN_YES;
}
/*
* weechat::remove_timer_handler: remove a timer handler
*/
static XS (XS_weechat_remove_timer_handler)
{
char *function;
unsigned int integer;
dXSARGS;
/* make gcc happy */
(void) cv;
if (!perl_current_script)
{
perl_plugin->print_server (perl_plugin,
"Perl error: unable to remove timer handler, "
"script not initialized");
XSRETURN_NO;
}
if (items < 1)
{
perl_plugin->print_server (perl_plugin,
"Perl error: wrong parameters for "
"\"remove_timer_handler\" function");
XSRETURN_NO;
}
function = SvPV (ST (0), integer);
weechat_script_remove_timer_handler (perl_plugin, perl_current_script,
function);
XSRETURN_YES;
}
/*
* weechat::get_info: get various infos
*/
@@ -1084,7 +1164,9 @@ weechat_perl_xs_init (pTHX)
newXS ("weechat::command", XS_weechat_command, "weechat");
newXS ("weechat::add_message_handler", XS_weechat_add_message_handler, "weechat");
newXS ("weechat::add_command_handler", XS_weechat_add_command_handler, "weechat");
newXS ("weechat::add_timer_handler", XS_weechat_add_timer_handler, "weechat");
newXS ("weechat::remove_handler", XS_weechat_remove_handler, "weechat");
newXS ("weechat::remove_timer_handler", XS_weechat_remove_timer_handler, "weechat");
newXS ("weechat::get_info", XS_weechat_get_info, "weechat");
newXS ("weechat::get_dcc_info", XS_weechat_get_dcc_info, "weechat");
newXS ("weechat::get_config", XS_weechat_get_config, "weechat");
@@ -1368,6 +1450,25 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
/* list Perl timer handlers */
plugin->print_server (plugin, "");
plugin->print_server (plugin, "Perl timer handlers:");
handler_found = 0;
for (ptr_handler = plugin->handlers;
ptr_handler; ptr_handler = ptr_handler->next_handler)
{
if ((ptr_handler->type == HANDLER_TIMER)
&& (ptr_handler->handler_args))
{
handler_found = 1;
plugin->print_server (plugin, " %d seconds => Perl(%s)",
ptr_handler->interval,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
break;
@@ -416,6 +416,46 @@ weechat_python_add_command_handler (PyObject *self, PyObject *args)
return Py_BuildValue ("i", 0);
}
/*
* weechat_python_add_timer_handler: add a timer handler
*/
static PyObject *
weechat_python_add_timer_handler (PyObject *self, PyObject *args)
{
int interval;
char *function;
/* make gcc happy */
(void) self;
if (!python_current_script)
{
python_plugin->print_server (python_plugin,
"Python error: unable to add timer handler, "
"script not initialized");
return Py_BuildValue ("i", 0);
}
interval = 10;
function = NULL;
if (!PyArg_ParseTuple (args, "is", &interval, &function))
{
python_plugin->print_server (python_plugin,
"Python error: wrong parameters for "
"\"add_timer_handler\" function");
return Py_BuildValue ("i", 0);
}
if (python_plugin->timer_handler_add (python_plugin, interval,
weechat_python_handler, function,
(void *)python_current_script))
return Py_BuildValue ("i", 1);
return Py_BuildValue ("i", 0);
}
/*
* weechat_python_remove_handler: remove a handler
*/
@@ -453,6 +493,42 @@ weechat_python_remove_handler (PyObject *self, PyObject *args)
return Py_BuildValue ("i", 1);
}
/*
* weechat_python_remove_timer_handler: remove a timer handler
*/
static PyObject *
weechat_python_remove_timer_handler (PyObject *self, PyObject *args)
{
char *function;
/* make gcc happy */
(void) self;
if (!python_current_script)
{
python_plugin->print_server (python_plugin,
"Python error: unable to remove timer handler, "
"script not initialized");
return Py_BuildValue ("i", 0);
}
function = NULL;
if (!PyArg_ParseTuple (args, "s", &function))
{
python_plugin->print_server (python_plugin,
"Python error: wrong parameters for "
"\"remove_timer_handler\" function");
return Py_BuildValue ("i", 0);
}
weechat_script_remove_timer_handler (python_plugin, python_current_script,
function);
return Py_BuildValue ("i", 1);
}
/*
* weechat_python_get_info: get various infos
*/
@@ -1019,7 +1095,9 @@ PyMethodDef weechat_python_funcs[] = {
{ "command", weechat_python_command, METH_VARARGS, "" },
{ "add_message_handler", weechat_python_add_message_handler, METH_VARARGS, "" },
{ "add_command_handler", weechat_python_add_command_handler, METH_VARARGS, "" },
{ "add_timer_handler", weechat_python_add_timer_handler, METH_VARARGS, "" },
{ "remove_handler", weechat_python_remove_handler, METH_VARARGS, "" },
{ "remove_timer_handler", weechat_python_remove_timer_handler, METH_VARARGS, "" },
{ "get_info", weechat_python_get_info, METH_VARARGS, "" },
{ "get_dcc_info", weechat_python_get_dcc_info, METH_VARARGS, "" },
{ "get_config", weechat_python_get_config, METH_VARARGS, "" },
@@ -1326,6 +1404,25 @@ weechat_python_cmd (t_weechat_plugin *plugin,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
/* list Python timer handlers */
plugin->print_server (plugin, "");
plugin->print_server (plugin, "Python timer handlers:");
handler_found = 0;
for (ptr_handler = plugin->handlers;
ptr_handler; ptr_handler = ptr_handler->next_handler)
{
if ((ptr_handler->type == HANDLER_TIMER)
&& (ptr_handler->handler_args))
{
handler_found = 1;
plugin->print_server (plugin, " %d seconds => Python(%s)",
ptr_handler->interval,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
break;
+107
View File
@@ -574,6 +574,52 @@ weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
return INT2FIX (0);
}
/*
* weechat_ruby_add_timer_handler: add a timer handler
*/
static VALUE
weechat_ruby_add_timer_handler (VALUE class, VALUE interval, VALUE function)
{
int c_interval;
char *c_function;
/* make gcc happy */
(void) class;
if (!ruby_current_script)
{
ruby_plugin->print_server (ruby_plugin,
"Ruby error: unable to add timer handler, "
"script not initialized");
return INT2FIX (0);
}
c_interval = 10;
c_function = NULL;
if (NIL_P (interval) || NIL_P (function))
{
ruby_plugin->print_server (ruby_plugin,
"Ruby error: wrong parameters for "
"\"add_timer_handler\" function");
return INT2FIX (0);
}
Check_Type (interval, T_FIXNUM);
Check_Type (function, T_STRING);
c_interval = FIX2INT (interval);
c_function = STR2CSTR (function);
if (ruby_plugin->timer_handler_add (ruby_plugin, c_interval,
weechat_ruby_handler, c_function,
(void *)ruby_current_script))
return INT2FIX (1);
return INT2FIX (0);
}
/*
* weechat_ruby_remove_handler: remove a handler
*/
@@ -617,6 +663,46 @@ weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
return INT2FIX (1);
}
/*
* weechat_ruby_remove_timer_handler: remove a timer handler
*/
static VALUE
weechat_ruby_remove_timer_handler (VALUE class, VALUE function)
{
char *c_function;
/* make gcc happy */
(void) class;
if (!ruby_current_script)
{
ruby_plugin->print_server (ruby_plugin,
"Ruby error: unable to remove timer handler, "
"script not initialized");
return INT2FIX (0);
}
c_function = NULL;
if (NIL_P (function))
{
ruby_plugin->print_server (ruby_plugin,
"Ruby error: wrong parameters for "
"\"remove_timer_handler\" function");
return INT2FIX (0);
}
Check_Type (function, T_STRING);
c_function = STR2CSTR (function);
weechat_script_remove_timer_handler (ruby_plugin, ruby_current_script,
c_function);
return INT2FIX (1);
}
/*
* weechat_ruby_get_info: get various infos
*/
@@ -1476,6 +1562,25 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
/* list Ruby timer handlers */
plugin->print_server (plugin, "");
plugin->print_server (plugin, "Ruby timer handlers:");
handler_found = 0;
for (ptr_handler = plugin->handlers;
ptr_handler; ptr_handler = ptr_handler->next_handler)
{
if ((ptr_handler->type == HANDLER_TIMER)
&& (ptr_handler->handler_args))
{
handler_found = 1;
plugin->print_server (plugin, " %d seconds => Ruby(%s)",
ptr_handler->interval,
ptr_handler->handler_args);
}
}
if (!handler_found)
plugin->print_server (plugin, " (none)");
break;
@@ -1612,7 +1717,9 @@ weechat_plugin_init (t_weechat_plugin *plugin)
rb_define_module_function (mWeechat, "command", weechat_ruby_command, -1);
rb_define_module_function (mWeechat, "add_message_handler", weechat_ruby_add_message_handler, 2);
rb_define_module_function (mWeechat, "add_command_handler", weechat_ruby_add_command_handler, -1);
rb_define_module_function (mWeechat, "add_timer_handler", weechat_ruby_add_timer_handler, 2);
rb_define_module_function (mWeechat, "remove_handler", weechat_ruby_remove_handler, 2);
rb_define_module_function (mWeechat, "remove_timer_handler", weechat_ruby_remove_timer_handler, 1);
rb_define_module_function (mWeechat, "get_info", weechat_ruby_get_info, -1);
rb_define_module_function (mWeechat, "get_dcc_info", weechat_ruby_get_dcc_info, 0);
rb_define_module_function (mWeechat, "get_config", weechat_ruby_get_config, 1);
+28 -1
View File
@@ -184,7 +184,7 @@ weechat_script_remove_handler (t_weechat_plugin *plugin,
t_plugin_handler *ptr_handler, *next_handler;
char *ptr_arg1;
/* search and remove message handlers */
/* search and remove handlers */
ptr_handler = plugin->handlers;
while (ptr_handler)
{
@@ -208,6 +208,33 @@ weechat_script_remove_handler (t_weechat_plugin *plugin,
}
}
/*
* weechat_script_remove_timer_handler: remove a timer handler for a script
*/
void
weechat_script_remove_timer_handler (t_weechat_plugin *plugin,
t_plugin_script *script,
char *function)
{
t_plugin_handler *ptr_handler, *next_handler;
/* search and remove timer handlers */
ptr_handler = plugin->handlers;
while (ptr_handler)
{
if (((t_plugin_script *)ptr_handler->handler_pointer == script)
&& (plugin->ascii_strcasecmp (plugin, ptr_handler->handler_args, function) == 0))
{
next_handler = ptr_handler->next_handler;
plugin->handler_remove (plugin, ptr_handler);
ptr_handler = next_handler;
}
else
ptr_handler = ptr_handler->next_handler;
}
}
/*
* weechat_script_get_plugin_config: get a value of a script option
* format in file is: plugin.script.option=value
+3
View File
@@ -51,6 +51,9 @@ extern void weechat_script_remove (t_weechat_plugin *,
extern void weechat_script_remove_handler (t_weechat_plugin *,
t_plugin_script *,
char *, char *);
extern void weechat_script_remove_timer_handler (t_weechat_plugin *,
t_plugin_script *,
char *);
extern char *weechat_script_get_plugin_config (t_weechat_plugin *,
t_plugin_script *,
char *);
+13 -2
View File
@@ -133,8 +133,9 @@ typedef enum t_handler_type t_handler_type;
enum t_handler_type
{
HANDLER_MESSAGE,
HANDLER_COMMAND
HANDLER_MESSAGE = 0, /* IRC message handler */
HANDLER_COMMAND, /* command handler */
HANDLER_TIMER /* timer handler */
};
typedef struct t_plugin_handler t_plugin_handler;
@@ -153,6 +154,10 @@ struct t_plugin_handler
char *arguments_description; /* (for /help) args long description */
char *completion_template; /* template for completion */
/* data for timer handler */
int interval; /* interval between two calls to fct */
int remaining; /* seconds remaining before next call */
/* data common to all handlers */
t_plugin_handler_func *handler; /* pointer to handler */
char *handler_args; /* arguments sent to handler */
@@ -210,6 +215,9 @@ struct t_weechat_plugin
char *,
t_plugin_handler_func *,
char *, void *);
t_plugin_handler *(*timer_handler_add) (t_weechat_plugin *, int,
t_plugin_handler_func *,
char *, void *);
void (*handler_remove) (t_weechat_plugin *, t_plugin_handler *);
void (*handler_remove_all) (t_weechat_plugin *);
@@ -259,6 +267,9 @@ extern t_plugin_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *, cha
char *,
t_plugin_handler_func *,
char *, void *);
extern t_plugin_handler *weechat_plugin_timer_handler_add (t_weechat_plugin *, int,
t_plugin_handler_func *,
char *, void *);
extern void weechat_plugin_handler_remove (t_weechat_plugin *, t_plugin_handler *);
extern void weechat_plugin_handler_remove_all (t_weechat_plugin *);