From e9603acb1a1943bda3c2cc809e5e39ff8a13b68c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 6 May 2008 16:51:30 +0200 Subject: IRC DCC chat and file (without resume) reintroduced, via xfer plugin (called by /dcc command) --- src/plugins/scripts/lua/weechat-lua-api.c | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/plugins/scripts/lua/weechat-lua-api.c') diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index fe874cb46..9e0431da1 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -3290,6 +3290,42 @@ weechat_lua_api_buffer_search (lua_State *L) LUA_RETURN_STRING_FREE(result); } +/* + * weechat_lua_api_buffer_clear: clear a buffer + */ + +static int +weechat_lua_api_buffer_clear (lua_State *L) +{ + const char *buffer; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_clear"); + LUA_RETURN_ERROR; + } + + buffer = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_clear"); + LUA_RETURN_ERROR; + } + + buffer = lua_tostring (lua_current_interpreter, -1); + + weechat_buffer_clear (script_str2ptr ((char *)buffer)); + + LUA_RETURN_OK; +} + /* * weechat_lua_api_buffer_close: close a buffer */ @@ -4794,6 +4830,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "unhook_all", &weechat_lua_api_unhook_all }, { "buffer_new", &weechat_lua_api_buffer_new }, { "buffer_search", &weechat_lua_api_buffer_search }, + { "buffer_clear", &weechat_lua_api_buffer_clear }, { "buffer_close", &weechat_lua_api_buffer_close }, { "buffer_get_string", &weechat_lua_api_buffer_get_string }, { "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer }, -- cgit v1.2.3