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

Add description of arguments for API functions hook_info and hook_infolist

This commit is contained in:
Sebastien Helleu
2010-02-12 17:15:30 +01:00
parent 8d25a75200
commit 922e67cabd
42 changed files with 1697 additions and 294 deletions
+2
View File
@@ -94,5 +94,7 @@ alias_info_init ()
{
/* alias infolist hooks */
weechat_hook_infolist ("alias", N_("list of aliases"),
N_("alias pointer (optional)"),
N_("alias name (can start or end with \"*\" as joker) (optional)"),
&alias_info_get_infolist_cb, NULL);
}
+1 -1
View File
@@ -53,6 +53,6 @@ void
fifo_info_init ()
{
/* fifo info hooks */
weechat_hook_info ("fifo_filename", N_("name of FIFO pipe"),
weechat_hook_info ("fifo_filename", N_("name of FIFO pipe"), NULL,
&fifo_info_get_info_cb, NULL);
}
+14 -1
View File
@@ -395,23 +395,36 @@ irc_info_init ()
{
/* info hooks */
weechat_hook_info ("irc_is_channel", N_("1 if string is an IRC channel"),
N_("channel name"),
&irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_nick", N_("get current nick on a server"),
N_("server name"),
&irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_nick_from_host", N_("get nick from IRC host"),
N_("IRC host (like `:nick!name@server.com`)"),
&irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_nick_color", N_("get nick color"),
N_("nickname"),
&irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_buffer", N_("get buffer pointer for an IRC server/channel"),
weechat_hook_info ("irc_buffer", N_("get buffer pointer for an IRC server/channel/nick"),
N_("server,channel,nick (channel and nicks are optional)"),
&irc_info_get_info_cb, NULL);
/* infolist hooks */
weechat_hook_infolist ("irc_server", N_("list of IRC servers"),
N_("server pointer (optional)"),
N_("server name (can start or end with \"*\" as joker) (optional)"),
&irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_channel", N_("list of channels for an IRC server"),
N_("channel pointer (optional)"),
N_("server name"),
&irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_nick", N_("list of nicks for an IRC channel"),
N_("nick pointer (optional)"),
N_("server,channel,nick (channel and nick are optional)"),
&irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_ignore", N_("list of IRC ignores"),
N_("ignore pointer (optional)"),
NULL,
&irc_info_get_infolist_cb, NULL);
}
+3 -1
View File
@@ -91,7 +91,9 @@ logger_info_get_infolist_cb (void *data, const char *infolist_name,
void
logger_info_init ()
{
/* irc infolist hooks */
/* logger infolist hooks */
weechat_hook_infolist ("logger_buffer", N_("list of logger buffers"),
N_("logger pointer (optional)"),
NULL,
&logger_info_get_infolist_cb, NULL);
}
+43 -14
View File
@@ -928,62 +928,91 @@ void
plugin_api_init ()
{
/* WeeChat core info hooks */
hook_info (NULL, "version", N_("WeeChat version"),
hook_info (NULL, "version", N_("WeeChat version"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "version_number", N_("WeeChat version (as number)"),
hook_info (NULL, "version_number", N_("WeeChat version (as number)"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "date", N_("WeeChat compilation date"),
hook_info (NULL, "date", N_("WeeChat compilation date"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "dir_separator", N_("directory separator"),
hook_info (NULL, "dir_separator", N_("directory separator"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_dir", N_("WeeChat directory"),
hook_info (NULL, "weechat_dir", N_("WeeChat directory"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_libdir", N_("WeeChat \"lib\" directory"),
hook_info (NULL, "weechat_libdir", N_("WeeChat \"lib\" directory"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_sharedir", N_("WeeChat \"share\" directory"),
hook_info (NULL, "weechat_sharedir", N_("WeeChat \"share\" directory"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_localedir", N_("WeeChat \"locale\" directory"),
hook_info (NULL, "weechat_localedir", N_("WeeChat \"locale\" directory"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_site", N_("WeeChat site"),
hook_info (NULL, "weechat_site", N_("WeeChat site"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_site_download", N_("WeeChat site, download page"),
hook_info (NULL, "weechat_site_download", N_("WeeChat site, download page"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_terminal", N_("terminal charset"),
hook_info (NULL, "charset_terminal", N_("terminal charset"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_internal", N_("WeeChat internal charset"),
hook_info (NULL, "charset_internal", N_("WeeChat internal charset"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "inactivity", N_("keyboard inactivity (seconds)"),
hook_info (NULL, "inactivity", N_("keyboard inactivity (seconds)"), NULL,
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "filters_enabled", N_("1 if filters are enabled"),
hook_info (NULL, "filters_enabled", N_("1 if filters are enabled"), NULL,
&plugin_api_info_get_internal, NULL);
/* WeeChat core infolist hooks */
hook_infolist (NULL, "bar", N_("list of bars"),
N_("bar pointer (optional)"),
N_("bar name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "bar_item", N_("list of bar items"),
N_("bar item pointer (optional)"),
N_("bar item name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "bar_window", N_("list of bar windows"),
N_("bar window pointer (optional)"),
NULL,
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer", N_("list of buffers"),
N_("buffer pointer (optional)"),
N_("buffer name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer_lines", N_("lines of a buffer"),
N_("buffer pointer"),
NULL,
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "filter", N_("list of filters"),
NULL,
N_("filter name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "history", N_("history of commands"),
N_("buffer pointer (if not set, return global history) (optional)"),
NULL,
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", N_("list of hooks"),
NULL,
N_("hook type: command, timer, .. (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hotlist", N_("list of buffers in hotlist"),
NULL,
NULL,
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "key", N_("list of key bindings"),
NULL,
NULL,
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "nicklist", N_("nicks in nicklist for a buffer"),
N_("buffer pointer"),
N_("nick_xxx or group_xxx to get only nick/group xxx "
"(optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "option", N_("list of options"),
NULL,
N_("option name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "plugin", N_("list of plugins"),
N_("plugin pointer (optional)"),
N_("plugin name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "window", N_("list of windows"),
N_("window pointer (optional)"),
N_("window name (can start or end with \"*\" as joker) (optional)"),
&plugin_api_infolist_get_internal, NULL);
}
+2
View File
@@ -92,5 +92,7 @@ relay_info_init ()
{
/* relay infolist hooks */
weechat_hook_infolist ("relay", N_("list of relay clients"),
N_("relay pointer (optional)"),
NULL,
&relay_info_get_infolist_cb, NULL);
}
+20 -8
View File
@@ -4291,7 +4291,7 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
static int
weechat_lua_api_hook_info (lua_State *L)
{
const char *info_name, *description, *function, *data;
const char *info_name, *description, *args_description, *function, *data;
char *result;
int n;
@@ -4305,19 +4305,22 @@ weechat_lua_api_hook_info (lua_State *L)
}
info_name = NULL;
description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 4)
if (n < 5)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_info");
LUA_RETURN_EMPTY;
}
info_name = lua_tostring (lua_current_interpreter, -4);
description = lua_tostring (lua_current_interpreter, -3);
info_name = lua_tostring (lua_current_interpreter, -5);
description = lua_tostring (lua_current_interpreter, -4);
args_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
@@ -4325,6 +4328,7 @@ weechat_lua_api_hook_info (lua_State *L)
lua_current_script,
info_name,
description,
args_description,
&weechat_lua_api_hook_info_cb,
function,
data));
@@ -4375,7 +4379,8 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
static int
weechat_lua_api_hook_infolist (lua_State *L)
{
const char *infolist_name, *description, *function, *data;
const char *infolist_name, *description, *pointer_description;
const char *args_description, *function, *data;
char *result;
int n;
@@ -4389,19 +4394,24 @@ weechat_lua_api_hook_infolist (lua_State *L)
}
infolist_name = NULL;
description = NULL;
pointer_description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 4)
if (n < 6)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hook_infolist");
LUA_RETURN_EMPTY;
}
infolist_name = lua_tostring (lua_current_interpreter, -4);
description = lua_tostring (lua_current_interpreter, -3);
infolist_name = lua_tostring (lua_current_interpreter, -6);
description = lua_tostring (lua_current_interpreter, -5);
pointer_description = lua_tostring (lua_current_interpreter, -4);
args_description = lua_tostring (lua_current_interpreter, -3);
function = lua_tostring (lua_current_interpreter, -2);
data = lua_tostring (lua_current_interpreter, -1);
@@ -4409,6 +4419,8 @@ weechat_lua_api_hook_infolist (lua_State *L)
lua_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_lua_api_hook_infolist_cb,
function,
data));
+15 -8
View File
@@ -3650,7 +3650,7 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name,
XS (XS_weechat_api_hook_info)
{
char *result, *info_name, *description, *function, *data;
char *result, *info_name, *description, *args_description, *function, *data;
dXSARGS;
/* make C compiler happy */
@@ -3662,7 +3662,7 @@ XS (XS_weechat_api_hook_info)
PERL_RETURN_EMPTY;
}
if (items < 4)
if (items < 5)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_info");
PERL_RETURN_EMPTY;
@@ -3670,13 +3670,15 @@ XS (XS_weechat_api_hook_info)
info_name = SvPV (ST (0), PL_na);
description = SvPV (ST (1), PL_na);
function = SvPV (ST (2), PL_na);
data = SvPV (ST (3), PL_na);
args_description = SvPV (ST (2), PL_na);
function = SvPV (ST (3), PL_na);
data = SvPV (ST (4), PL_na);
result = script_ptr2str (script_api_hook_info (weechat_perl_plugin,
perl_current_script,
info_name,
description,
args_description,
&weechat_perl_api_hook_info_cb,
function,
data));
@@ -3726,7 +3728,8 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
XS (XS_weechat_api_hook_infolist)
{
char *result, *infolist_name, *description, *function, *data;
char *result, *infolist_name, *description, *pointer_description;
char *args_description, *function, *data;
dXSARGS;
/* make C compiler happy */
@@ -3738,7 +3741,7 @@ XS (XS_weechat_api_hook_infolist)
PERL_RETURN_EMPTY;
}
if (items < 4)
if (items < 6)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hook_infolist");
PERL_RETURN_EMPTY;
@@ -3746,13 +3749,17 @@ XS (XS_weechat_api_hook_infolist)
infolist_name = SvPV (ST (0), PL_na);
description = SvPV (ST (1), PL_na);
function = SvPV (ST (2), PL_na);
data = SvPV (ST (3), PL_na);
pointer_description = SvPV (ST (2), PL_na);
args_description = SvPV (ST (3), PL_na);
function = SvPV (ST (4), PL_na);
data = SvPV (ST (5), PL_na);
result = script_ptr2str (script_api_hook_infolist (weechat_perl_plugin,
perl_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_perl_api_hook_infolist_cb,
function,
data));
@@ -3838,7 +3838,7 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
static PyObject *
weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *description, *function, *data, *result;
char *info_name, *description, *args_description, *function, *data, *result;
PyObject *object;
/* make C compiler happy */
@@ -3852,11 +3852,12 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
info_name = NULL;
description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ssss", &info_name, &description, &function,
&data))
if (!PyArg_ParseTuple (args, "sssss", &info_name, &description,
&args_description, &function, &data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_info");
PYTHON_RETURN_EMPTY;
@@ -3866,6 +3867,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
python_current_script,
info_name,
description,
args_description,
&weechat_python_api_hook_info_cb,
function,
data));
@@ -3916,7 +3918,8 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
static PyObject *
weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
{
char *infolist_name, *description, *function, *data, *result;
char *infolist_name, *description, *pointer_description, *args_description;
char *function, *data, *result;
PyObject *object;
/* make C compiler happy */
@@ -3930,11 +3933,14 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
infolist_name = NULL;
description = NULL;
pointer_description = NULL;
args_description = NULL;
function = NULL;
data = NULL;
if (!PyArg_ParseTuple (args, "ssss", &infolist_name, &description,
&function, &data))
if (!PyArg_ParseTuple (args, "ssssss", &infolist_name, &description,
&pointer_description, &args_description, &function,
&data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hook_infolist");
PYTHON_RETURN_EMPTY;
@@ -3944,6 +3950,8 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
python_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_python_api_hook_infolist_cb,
function,
data));
+26 -10
View File
@@ -4428,9 +4428,10 @@ weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
static VALUE
weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
VALUE function, VALUE data)
VALUE args_description, VALUE function, VALUE data)
{
char *c_info_name, *c_description, *c_function, *c_data, *result;
char *c_info_name, *c_description, *c_args_description, *c_function;
char *c_data, *result;
VALUE return_value;
/* make C compiler happy */
@@ -4444,11 +4445,12 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
c_info_name = NULL;
c_description = NULL;
c_args_description = NULL;
c_function = NULL;
c_data = NULL;
if (NIL_P (info_name) || NIL_P (description) || NIL_P (function)
|| NIL_P (data))
if (NIL_P (info_name) || NIL_P (description) || NIL_P (args_description)
|| NIL_P (function) || NIL_P (data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_info");
RUBY_RETURN_EMPTY;
@@ -4456,11 +4458,13 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
Check_Type (info_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (args_description, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
c_info_name = STR2CSTR (info_name);
c_description = STR2CSTR (description);
c_args_description = STR2CSTR (args_description);
c_function = STR2CSTR (function);
c_data = STR2CSTR (data);
@@ -4468,6 +4472,7 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
ruby_current_script,
c_info_name,
c_description,
c_args_description,
&weechat_ruby_api_hook_info_cb,
c_function,
c_data));
@@ -4517,10 +4522,12 @@ weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
static VALUE
weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
VALUE description, VALUE function,
VALUE description, VALUE pointer_description,
VALUE args_description, VALUE function,
VALUE data)
{
char *c_infolist_name, *c_description, *c_function, *c_data, *result;
char *c_infolist_name, *c_description, *c_pointer_description;
char *c_args_description, *c_function, *c_data, *result;
VALUE return_value;
/* make C compiler happy */
@@ -4534,11 +4541,14 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
c_infolist_name = NULL;
c_description = NULL;
c_pointer_description = NULL;
c_args_description = NULL;
c_function = NULL;
c_data = NULL;
if (NIL_P (infolist_name) || NIL_P (description) || NIL_P (function)
|| NIL_P (data))
if (NIL_P (infolist_name) || NIL_P (description)
|| NIL_P (pointer_description) || NIL_P (args_description)
|| NIL_P (function) || NIL_P (data))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hook_infolist");
RUBY_RETURN_EMPTY;
@@ -4546,11 +4556,15 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
Check_Type (infolist_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (pointer_description, T_STRING);
Check_Type (args_description, T_STRING);
Check_Type (function, T_STRING);
Check_Type (data, T_STRING);
c_infolist_name = STR2CSTR (infolist_name);
c_description = STR2CSTR (description);
c_pointer_description = STR2CSTR (pointer_description);
c_args_description = STR2CSTR (args_description);
c_function = STR2CSTR (function);
c_data = STR2CSTR (data);
@@ -4558,6 +4572,8 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
ruby_current_script,
c_infolist_name,
c_description,
c_pointer_description,
c_args_description,
&weechat_ruby_api_hook_infolist_cb,
c_function,
c_data));
@@ -7078,8 +7094,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "hook_completion_list_add", &weechat_ruby_api_hook_completion_list_add, 4);
rb_define_module_function (ruby_mWeechat, "hook_modifier", &weechat_ruby_api_hook_modifier, 3);
rb_define_module_function (ruby_mWeechat, "hook_modifier_exec", &weechat_ruby_api_hook_modifier_exec, 3);
rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 4);
rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 4);
rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 5);
rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 6);
rb_define_module_function (ruby_mWeechat, "unhook", &weechat_ruby_api_unhook, 1);
rb_define_module_function (ruby_mWeechat, "unhook_all", &weechat_ruby_api_unhook_all, 0);
rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 5);
+5 -1
View File
@@ -1169,6 +1169,7 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -1182,7 +1183,7 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_info (info_name, description,
new_hook = weechat_hook_info (info_name, description, args_description,
callback, new_script_callback);
if (!new_hook)
{
@@ -1209,6 +1210,8 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
@@ -1224,6 +1227,7 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
return NULL;
new_hook = weechat_hook_infolist (infolist_name, description,
pointer_description, args_description,
callback, new_script_callback);
if (!new_hook)
{
+3
View File
@@ -236,6 +236,7 @@ extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plu
struct t_plugin_script *script,
const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -245,6 +246,8 @@ extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat
struct t_plugin_script *script,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
+2
View File
@@ -278,6 +278,8 @@ script_init (struct t_weechat_plugin *weechat_plugin,
weechat_hook_completion (string, N_("list of scripts"),
callback_completion, NULL);
weechat_hook_infolist (string, N_("list of scripts"),
N_("script pointer (optional)"),
N_("script name (can start or end with \"*\" as joker) (optional)"),
callback_infolist, NULL);
free (string);
}
+15 -8
View File
@@ -4110,7 +4110,7 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *result, *info_name, *description, *function, *data;
char *result, *info_name, *description, *args_description, *function, *data;
int i;
/* make C compiler happy */
@@ -4122,7 +4122,7 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 5)
if (objc < 6)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_info");
TCL_RETURN_EMPTY;
@@ -4130,13 +4130,15 @@ weechat_tcl_api_hook_info (ClientData clientData, Tcl_Interp *interp,
info_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
data = Tcl_GetStringFromObj (objv[4], &i);
args_description = Tcl_GetStringFromObj (objv[3], &i);
function = Tcl_GetStringFromObj (objv[4], &i);
data = Tcl_GetStringFromObj (objv[5], &i);
result = script_ptr2str (script_api_hook_info (weechat_tcl_plugin,
tcl_current_script,
info_name,
description,
args_description,
&weechat_tcl_api_hook_info_cb,
function,
data));
@@ -4189,7 +4191,8 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *result, *infolist_name, *description, *function, *data;
char *result, *infolist_name, *description, *pointer_description;
char *args_description, *function, *data;
int i;
/* make C compiler happy */
@@ -4201,7 +4204,7 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
if (objc < 5)
if (objc < 7)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hook_infolist");
TCL_RETURN_EMPTY;
@@ -4209,13 +4212,17 @@ weechat_tcl_api_hook_infolist (ClientData clientData, Tcl_Interp *interp,
infolist_name = Tcl_GetStringFromObj (objv[1], &i);
description = Tcl_GetStringFromObj (objv[2], &i);
function = Tcl_GetStringFromObj (objv[3], &i);
data = Tcl_GetStringFromObj (objv[4], &i);
pointer_description = Tcl_GetStringFromObj (objv[3], &i);
args_description = Tcl_GetStringFromObj (objv[4], &i);
function = Tcl_GetStringFromObj (objv[5], &i);
data = Tcl_GetStringFromObj (objv[6], &i);
result = script_ptr2str (script_api_hook_infolist (weechat_tcl_plugin,
tcl_current_script,
infolist_name,
description,
pointer_description,
args_description,
&weechat_tcl_api_hook_infolist_cb,
function,
data));
+13 -6
View File
@@ -34,7 +34,7 @@ struct t_weelist;
struct timeval;
/* API version (used to check that plugin has same API and can be loaded) */
#define WEECHAT_PLUGIN_API_VERSION "20100209-01"
#define WEECHAT_PLUGIN_API_VERSION "20100212-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -462,6 +462,7 @@ struct t_weechat_plugin
struct t_hook *(*hook_info) (struct t_weechat_plugin *plugin,
const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -469,6 +470,8 @@ struct t_weechat_plugin
struct t_hook *(*hook_infolist) (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
@@ -1017,14 +1020,18 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__string) \
weechat_plugin->hook_modifier_exec(weechat_plugin, __modifier, \
__modifier_data, __string)
#define weechat_hook_info(__info_name, __description, __callback, \
__data) \
#define weechat_hook_info(__info_name, __description, \
__args_description, __callback, __data) \
weechat_plugin->hook_info(weechat_plugin, __info_name, \
__description, __callback, __data)
__description, __args_description, \
__callback, __data)
#define weechat_hook_infolist(__infolist_name, __description, \
__callback, __data) \
__pointer_description, \
__args_description, __callback, __data) \
weechat_plugin->hook_infolist(weechat_plugin, __infolist_name, \
__description, __callback, __data)
__description, __pointer_description, \
__args_description, __callback, \
__data)
#define weechat_unhook(__hook) \
weechat_plugin->unhook( __hook)
#define weechat_unhook_all() \
+2
View File
@@ -91,5 +91,7 @@ xfer_info_init ()
{
/* xfer infolist hooks */
weechat_hook_infolist ("xfer", N_("list of xfer"),
N_("xfer pointer (optional)"),
NULL,
&xfer_info_get_infolist_cb, NULL);
}