summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c28
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c23
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c20
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c36
-rw-r--r--src/plugins/scripts/script-api.c6
-rw-r--r--src/plugins/scripts/script-api.h3
-rw-r--r--src/plugins/scripts/script.c2
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c23
8 files changed, 100 insertions, 41 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index ff2db2fd1..d166782b9 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -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));
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 4406b097c..660af505f 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -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));
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index f54772f55..5ab77a57a 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -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));
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index f81be474b..a5af066cd 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -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);
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 89ba84444..879e5bb97 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -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)
{
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 4b641f502..2f99b819e 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -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,
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index aea1f2611..8d8cf8fc6 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -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);
}
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 2e3553256..65fcb1bd4 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -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));