diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-09-21 17:31:27 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-09-21 17:31:27 +0200 |
commit | 86323231fd321da02fa6ed5864cca2816d5bffeb (patch) | |
tree | 92fbc576543089914efb4b19afca1dee2d64cfd2 /src | |
parent | 051788f7317487a6ca752f143d8a7270f693acd5 (diff) | |
download | weechat-86323231fd321da02fa6ed5864cca2816d5bffeb.zip |
Add missing function "infolist_reset_item_cursor" in script API (bug #31057)
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 38 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 30 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 33 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 35 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 35 |
5 files changed, 171 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 1c38cc2c7..18205095b 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -6747,6 +6747,43 @@ weechat_lua_api_infolist_prev (lua_State *L) } /* + * weechat_lua_api_infolist_reset_item_cursor: reset pointer to current item in + * infolist + */ + +static int +weechat_lua_api_infolist_reset_item_cursor (lua_State *L) +{ + const char *infolist; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + LUA_RETURN_ERROR; + } + + infolist = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + LUA_RETURN_ERROR; + } + + infolist = lua_tostring (lua_current_interpreter, -1); + + weechat_infolist_reset_item_cursor (script_str2ptr (infolist)); + + LUA_RETURN_OK; +} + +/* * weechat_lua_api_infolist_fields: get list of fields for current item of infolist */ @@ -7714,6 +7751,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "infolist_get", &weechat_lua_api_infolist_get }, { "infolist_next", &weechat_lua_api_infolist_next }, { "infolist_prev", &weechat_lua_api_infolist_prev }, + { "infolist_reset_item_cursor", &weechat_lua_api_infolist_reset_item_cursor }, { "infolist_fields", &weechat_lua_api_infolist_fields }, { "infolist_integer", &weechat_lua_api_infolist_integer }, { "infolist_string", &weechat_lua_api_infolist_string }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 6d0e8257b..7d5b91e39 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -5693,6 +5693,35 @@ XS (XS_weechat_api_infolist_prev) } /* + * weechat::infolist_reset_item_cursor: reset pointer to current item in + * infolist + */ + +XS (XS_weechat_api_infolist_reset_item_cursor) +{ + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + PERL_RETURN_ERROR; + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + PERL_RETURN_ERROR; + } + + weechat_infolist_reset_item_cursor (script_str2ptr (SvPV (ST (0), PL_na))); /* infolist */ + + PERL_RETURN_OK; +} + +/* * weechat::infolist_fields: get list of fields for current item of infolist */ @@ -6215,6 +6244,7 @@ weechat_perl_api_init (pTHX) newXS ("weechat::infolist_get", XS_weechat_api_infolist_get, "weechat"); newXS ("weechat::infolist_next", XS_weechat_api_infolist_next, "weechat"); newXS ("weechat::infolist_prev", XS_weechat_api_infolist_prev, "weechat"); + newXS ("weechat::infolist_reset_item_cursor", XS_weechat_api_infolist_reset_item_cursor, "weechat"); newXS ("weechat::infolist_fields", XS_weechat_api_infolist_fields, "weechat"); newXS ("weechat::infolist_integer", XS_weechat_api_infolist_integer, "weechat"); newXS ("weechat::infolist_string", XS_weechat_api_infolist_string, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 6a20339eb..be252b7e3 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -6001,6 +6001,38 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args) } /* + * weechat_python_api_infolist_reset_item_cursor: reset pointer to current item + * in infolist + */ + +static PyObject * +weechat_python_api_infolist_reset_item_cursor (PyObject *self, PyObject *args) +{ + char *infolist; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + PYTHON_RETURN_ERROR; + } + + infolist = NULL; + + if (!PyArg_ParseTuple (args, "s", &infolist)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + PYTHON_RETURN_ERROR; + } + + weechat_infolist_reset_item_cursor (script_str2ptr (infolist)); + + PYTHON_RETURN_OK; +} + +/* * weechat_python_api_infolist_fields: get list of fields for current item of infolist */ @@ -6532,6 +6564,7 @@ PyMethodDef weechat_python_funcs[] = { "infolist_get", &weechat_python_api_infolist_get, METH_VARARGS, "" }, { "infolist_next", &weechat_python_api_infolist_next, METH_VARARGS, "" }, { "infolist_prev", &weechat_python_api_infolist_prev, METH_VARARGS, "" }, + { "infolist_reset_item_cursor", &weechat_python_api_infolist_reset_item_cursor, METH_VARARGS, "" }, { "infolist_fields", &weechat_python_api_infolist_fields, METH_VARARGS, "" }, { "infolist_integer", &weechat_python_api_infolist_integer, METH_VARARGS, "" }, { "infolist_string", &weechat_python_api_infolist_string, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 242bc38a2..4e13aba34 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -6904,6 +6904,40 @@ weechat_ruby_api_infolist_prev (VALUE class, VALUE infolist) } /* + * weechat_ruby_api_infolist_reset_item_cursor: reset pointer to current item + * in infolist + */ + +static VALUE +weechat_ruby_api_infolist_reset_item_cursor (VALUE class, VALUE infolist) +{ + char *c_infolist; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + RUBY_RETURN_ERROR; + } + + if (NIL_P (infolist)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + RUBY_RETURN_ERROR; + } + + Check_Type (infolist, T_STRING); + + c_infolist = StringValuePtr (infolist); + + weechat_infolist_reset_item_cursor (script_str2ptr (c_infolist)); + + RUBY_RETURN_OK; +} + +/* * weechat_ruby_api_infolist_fields: get list of fields for current item of infolist */ @@ -7516,6 +7550,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "infolist_get", &weechat_ruby_api_infolist_get, 3); rb_define_module_function (ruby_mWeechat, "infolist_next", &weechat_ruby_api_infolist_next, 1); rb_define_module_function (ruby_mWeechat, "infolist_prev", &weechat_ruby_api_infolist_prev, 1); + rb_define_module_function (ruby_mWeechat, "infolist_reset_item_cursor", &weechat_ruby_api_infolist_reset_item_cursor, 1); rb_define_module_function (ruby_mWeechat, "infolist_fields", &weechat_ruby_api_infolist_fields, 1); rb_define_module_function (ruby_mWeechat, "infolist_integer", &weechat_ruby_api_infolist_integer, 2); rb_define_module_function (ruby_mWeechat, "infolist_string", &weechat_ruby_api_infolist_string, 2); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 538ce29ec..90ea1be46 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -6350,6 +6350,39 @@ weechat_tcl_api_infolist_prev (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_infolist_reset_item_cursor: reset pointer to current item in + * infolist + */ + +static int +weechat_tcl_api_infolist_reset_item_cursor (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + TCL_RETURN_ERROR; + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_reset_item_cursor"); + TCL_RETURN_ERROR; + } + + weechat_infolist_reset_item_cursor (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ + + TCL_RETURN_OK; +} + +/* * weechat_tcl_api_infolist_fields: get list of fields for current item of * infolist */ @@ -7141,6 +7174,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) weechat_tcl_api_infolist_next, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::infolist_prev", weechat_tcl_api_infolist_prev, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::infolist_reset_item_cursor", + weechat_tcl_api_infolist_reset_item_cursor, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::infolist_fields", weechat_tcl_api_infolist_fields, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::infolist_integer", |