diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2015-08-13 20:50:15 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2015-08-13 20:50:15 +0200 |
commit | 4716e81d4e0f94cfed9a3e2b4dc103bf4bf83459 (patch) | |
tree | d63fc8c81d11c442bcfcccff1cfac09bafa53d2f /src | |
parent | 7033fdd0cbb5e066f5e5e9a1d6784196b5211fae (diff) | |
download | weechat-4716e81d4e0f94cfed9a3e2b4dc103bf4bf83459.zip |
api: add missing function infolist_search_var() in script API (issue #484)
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 17 | ||||
-rw-r--r-- | src/plugins/javascript/weechat-js-api.cpp | 18 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 19 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 19 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 18 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 23 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 17 |
7 files changed, 131 insertions, 0 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 7f5962837..676a85e50 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -4094,6 +4094,22 @@ weechat_guile_api_infolist_new_var_time (SCM item, SCM name, SCM value) } SCM +weechat_guile_api_infolist_search_var (SCM infolist, SCM name) +{ + char *result; + SCM return_value; + + API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY); + if (!scm_is_string (infolist) || !scm_is_string (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(API_SCM_TO_STRING(infolist)), + API_SCM_TO_STRING(name))); + + API_RETURN_STRING_FREE(result); +} + +SCM weechat_guile_api_infolist_get (SCM name, SCM pointer, SCM arguments) { char *result; @@ -4860,6 +4876,7 @@ weechat_guile_api_module_init (void *data) API_DEF_FUNC(infolist_new_var_string, 3); API_DEF_FUNC(infolist_new_var_pointer, 3); API_DEF_FUNC(infolist_new_var_time, 3); + API_DEF_FUNC(infolist_search_var, 2); API_DEF_FUNC(infolist_get, 3); API_DEF_FUNC(infolist_next, 1); API_DEF_FUNC(infolist_prev, 1); diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index b3c959d5c..a5a07c432 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -4050,6 +4050,23 @@ API_FUNC(infolist_new_var_time) API_RETURN_STRING_FREE(result); } +API_FUNC(infolist_search_var) +{ + char *result; + + API_INIT_FUNC(1, "infolist_search_var", "ss", API_RETURN_EMPTY); + + v8::String::Utf8Value infolist(args[0]); + v8::String::Utf8Value name(args[1]); + + result = API_PTR2STR( + weechat_infolist_search_var ( + (struct t_infolist *)API_STR2PTR(*infolist), + *name)); + + API_RETURN_STRING_FREE(result); +} + API_FUNC(infolist_get) { char *result; @@ -4872,6 +4889,7 @@ WeechatJsV8::loadLibs() API_DEF_FUNC(infolist_new_var_string); API_DEF_FUNC(infolist_new_var_pointer); API_DEF_FUNC(infolist_new_var_time); + API_DEF_FUNC(infolist_search_var); API_DEF_FUNC(infolist_get); API_DEF_FUNC(infolist_next); API_DEF_FUNC(infolist_prev); diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 55cc1771a..cfbe45f9c 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -4326,6 +4326,24 @@ API_FUNC(infolist_new_var_time) API_RETURN_STRING_FREE(result); } +API_FUNC(infolist_search_var) +{ + const char *infolist, *name; + char *result; + + API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY); + if (lua_gettop (L) < 2) + API_WRONG_ARGS(API_RETURN_EMPTY); + + infolist = lua_tostring (L, -2); + name = lua_tostring (L, -1); + + result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(infolist), + name)); + + API_RETURN_STRING_FREE(result); +} + API_FUNC(infolist_get) { const char *name, *pointer, *arguments; @@ -5152,6 +5170,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = { API_DEF_FUNC(infolist_new_var_string), API_DEF_FUNC(infolist_new_var_pointer), API_DEF_FUNC(infolist_new_var_time), + API_DEF_FUNC(infolist_search_var), API_DEF_FUNC(infolist_get), API_DEF_FUNC(infolist_next), API_DEF_FUNC(infolist_prev), diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index e88d1108a..61631c72b 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -4251,6 +4251,24 @@ API_FUNC(infolist_new_var_time) API_RETURN_STRING_FREE(result); } +API_FUNC(infolist_search_var) +{ + char *infolist, *name, *result; + dXSARGS; + + API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY); + if (items < 2) + API_WRONG_ARGS(API_RETURN_EMPTY); + + infolist = SvPV_nolen (ST (0)); + name = SvPV_nolen (ST (1)); + + result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(infolist), + name)); + + API_RETURN_STRING_FREE(result); +} + API_FUNC(infolist_get) { char *result, *name, *pointer, *arguments; @@ -5096,6 +5114,7 @@ weechat_perl_api_init (pTHX) API_DEF_FUNC(infolist_new_var_string); API_DEF_FUNC(infolist_new_var_pointer); API_DEF_FUNC(infolist_new_var_time); + API_DEF_FUNC(infolist_search_var); API_DEF_FUNC(infolist_get); API_DEF_FUNC(infolist_next); API_DEF_FUNC(infolist_prev); diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 19958e46b..1eca2723a 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -4273,6 +4273,23 @@ API_FUNC(infolist_new_var_time) API_RETURN_STRING_FREE(result); } +API_FUNC(infolist_search_var) +{ + char *infolist, *name, *result; + PyObject *return_value; + + API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY); + infolist = NULL; + name = NULL; + if (!PyArg_ParseTuple (args, "ss", &infolist, &name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(infolist), + name)); + + API_RETURN_STRING_FREE(result); +} + API_FUNC(infolist_get) { char *name, *pointer, *arguments, *result; @@ -5077,6 +5094,7 @@ PyMethodDef weechat_python_funcs[] = API_DEF_FUNC(infolist_new_var_string), API_DEF_FUNC(infolist_new_var_pointer), API_DEF_FUNC(infolist_new_var_time), + API_DEF_FUNC(infolist_search_var), API_DEF_FUNC(infolist_get), API_DEF_FUNC(infolist_next), API_DEF_FUNC(infolist_prev), diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 03f9df04f..a8bb43612 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -5179,6 +5179,28 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE item, } static VALUE +weechat_ruby_api_infolist_search_var (VALUE class, VALUE infolist, VALUE name) +{ + char *c_infolist, *c_name, *result; + VALUE return_value; + + API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY); + if (NIL_P (infolist) || NIL_P (name)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + Check_Type (infolist, T_STRING); + Check_Type (name, T_STRING); + + c_infolist = StringValuePtr (infolist); + c_name = StringValuePtr (name); + + result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(c_infolist), + c_name)); + + API_RETURN_STRING_FREE(result); +} + +static VALUE weechat_ruby_api_infolist_get (VALUE class, VALUE name, VALUE pointer, VALUE arguments) { @@ -6218,6 +6240,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) API_DEF_FUNC(infolist_new_var_string, 3); API_DEF_FUNC(infolist_new_var_pointer, 3); API_DEF_FUNC(infolist_new_var_time, 3); + API_DEF_FUNC(infolist_search_var, 2); API_DEF_FUNC(infolist_get, 3); API_DEF_FUNC(infolist_next, 1); API_DEF_FUNC(infolist_prev, 1); diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 4d1990d8d..d75436878 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -4589,6 +4589,22 @@ API_FUNC(infolist_new_var_time) API_RETURN_STRING_FREE(result); } +API_FUNC(infolist_search_var) +{ + Tcl_Obj *objp; + char *result; + int i; + + API_INIT_FUNC(1, "infolist_search_var", API_RETURN_EMPTY); + if (objc < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = API_PTR2STR(weechat_infolist_search_var (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ + Tcl_GetStringFromObj (objv[2], &i))); /* name */ + + API_RETURN_STRING_FREE(result); +} + API_FUNC(infolist_get) { Tcl_Obj *objp; @@ -5558,6 +5574,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp) API_DEF_FUNC(infolist_new_var_string); API_DEF_FUNC(infolist_new_var_pointer); API_DEF_FUNC(infolist_new_var_time); + API_DEF_FUNC(infolist_search_var); API_DEF_FUNC(infolist_get); API_DEF_FUNC(infolist_next); API_DEF_FUNC(infolist_prev); |