diff options
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 37 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 31 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 34 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 36 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 37 |
5 files changed, 175 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index f0b64af5d..286b4509b 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -5303,6 +5303,42 @@ weechat_lua_api_current_window (lua_State *L) } /* + * weechat_lua_api_window_search_with_buffer: search a window with buffer + * pointer + */ + +static int +weechat_lua_api_window_search_with_buffer (lua_State *L) +{ + const char *buffer; + char *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + LUA_RETURN_EMPTY; + } + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -1); + + result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + + LUA_RETURN_STRING_FREE(result); +} + +/* * weechat_lua_api_window_get_integer: get a window property as integer */ @@ -7807,6 +7843,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "buffer_string_replace_local_var", &weechat_lua_api_buffer_string_replace_local_var }, { "buffer_match_list", &weechat_lua_api_buffer_match_list }, { "current_window", &weechat_lua_api_current_window }, + { "window_search_with_buffer", &weechat_lua_api_window_search_with_buffer }, { "window_get_integer", &weechat_lua_api_window_get_integer }, { "window_get_string", &weechat_lua_api_window_get_string }, { "window_get_pointer", &weechat_lua_api_window_get_pointer }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 6ea96f1bc..0219a8e08 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -4823,6 +4823,36 @@ XS (XS_weechat_api_current_window) } /* + * weechat::window_search_with_buffer: search a window with buffer pointer + */ + +XS (XS_weechat_api_window_search_with_buffer) +{ + char *result; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + PERL_RETURN_EMPTY; + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + PERL_RETURN_EMPTY; + } + + result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (SvPV (ST (0), PL_na)))); + + PERL_RETURN_STRING_FREE(result); +} + + +/* * weechat::window_get_integer: get a window property as integer */ @@ -6742,6 +6772,7 @@ weechat_perl_api_init (pTHX) newXS ("weechat::buffer_string_replace_local_var", XS_weechat_api_buffer_string_replace_local_var, "weechat"); newXS ("weechat::buffer_match_list", XS_weechat_api_buffer_match_list, "weechat"); newXS ("weechat::current_window", XS_weechat_api_current_window, "weechat"); + newXS ("weechat::window_search_with_buffer", XS_weechat_api_window_search_with_buffer, "weechat"); newXS ("weechat::window_get_integer", XS_weechat_api_window_get_integer, "weechat"); newXS ("weechat::window_get_string", XS_weechat_api_window_get_string, "weechat"); newXS ("weechat::window_get_pointer", XS_weechat_api_window_get_pointer, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 58dd89af1..9a3924fc4 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -5081,6 +5081,39 @@ weechat_python_api_current_window (PyObject *self, PyObject *args) } /* + * weechat_python_api_window_search_with_buffer: search a window with buffer + * pointer + */ + +static PyObject * +weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args) +{ + char *buffer, *result; + PyObject *object; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + PYTHON_RETURN_EMPTY; + } + + buffer = NULL; + + if (!PyArg_ParseTuple (args, "s", &buffer)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + PYTHON_RETURN_EMPTY; + } + + result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + + PYTHON_RETURN_STRING_FREE(result); +} + +/* * weechat_python_api_window_get_integer get a window property as integer */ @@ -7076,6 +7109,7 @@ PyMethodDef weechat_python_funcs[] = { "buffer_string_replace_local_var", &weechat_python_api_buffer_string_replace_local_var, METH_VARARGS, "" }, { "buffer_match_list", &weechat_python_api_buffer_match_list, METH_VARARGS, "" }, { "current_window", &weechat_python_api_current_window, METH_VARARGS, "" }, + { "window_search_with_buffer", &weechat_python_api_window_search_with_buffer, METH_VARARGS, "" }, { "window_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" }, { "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" }, { "window_get_pointer", &weechat_python_api_window_get_pointer, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index af75cad78..cfa82cf88 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -5498,6 +5498,41 @@ weechat_ruby_api_current_window (VALUE class) } /* + * weechat_ruby_api_window_search_with_buffer: search a window with buffer + * pointer + */ + +static VALUE +weechat_ruby_api_window_search_with_buffer (VALUE class, VALUE buffer) +{ + char *c_buffer, *result; + VALUE return_value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + RUBY_RETURN_EMPTY; + } + + if (NIL_P (buffer)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + RUBY_RETURN_EMPTY; + } + + Check_Type (buffer, T_STRING); + + c_buffer = StringValuePtr (buffer); + + result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (c_buffer))); + + RUBY_RETURN_STRING_FREE(result); +} + +/* * weechat_ruby_api_window_get_integer: get a window property as integer */ @@ -7745,6 +7780,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "buffer_string_replace_local_var", &weechat_ruby_api_buffer_string_replace_local_var, 2); rb_define_module_function (ruby_mWeechat, "buffer_match_list", &weechat_ruby_api_buffer_match_list, 2); rb_define_module_function (ruby_mWeechat, "current_window", &weechat_ruby_api_current_window, 0); + rb_define_module_function (ruby_mWeechat, "window_search_with_buffer", &weechat_ruby_api_window_search_with_buffer, 1); rb_define_module_function (ruby_mWeechat, "window_get_integer", &weechat_ruby_api_window_get_integer, 2); rb_define_module_function (ruby_mWeechat, "window_get_string", &weechat_ruby_api_window_get_string, 2); rb_define_module_function (ruby_mWeechat, "window_get_pointer", &weechat_ruby_api_window_get_pointer, 2); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 9f870efb9..b36d72ad3 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -5391,6 +5391,41 @@ weechat_tcl_api_current_window (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_window_search_with_buffer: search a window with buffer + * pointer + */ + +static int +weechat_tcl_api_window_search_with_buffer (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + TCL_RETURN_EMPTY; + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_search_with_buffer"); + TCL_RETURN_EMPTY; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + + result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + + TCL_RETURN_STRING_FREE(result); +} + +/* * weechat_tcl_api_window_get_integer: get a window property as integer */ @@ -7690,6 +7725,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) weechat_tcl_api_buffer_match_list, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::current_window", weechat_tcl_api_current_window, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::window_search_with_buffer", + weechat_tcl_api_window_search_with_buffer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::window_get_integer", weechat_tcl_api_window_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::window_get_string", |