diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-04-13 20:25:26 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-04-13 20:25:26 +0200 |
commit | 7673a700b38581e5ccdb37cd18976728aebbabcf (patch) | |
tree | 05b7b000082b92fa0b35ce1117932b853d91dd28 /src/plugins/scripts/lua | |
parent | 7d7eeceb8920a57d4efe9e270c786804fc673d4f (diff) | |
download | weechat-7673a700b38581e5ccdb37cd18976728aebbabcf.zip |
core: use buffer pointer instead of window in input functions, add new function window_search_with_buffer in plugin API
Diffstat (limited to 'src/plugins/scripts/lua')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 37 |
1 files changed, 37 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 }, |