summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/lua/weechat-lua.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-02-20 17:01:18 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-02-20 17:01:18 +0000
commit9373a7a47e4711e8db0549cec49da19db45330ae (patch)
tree5940281d9c986998fe96daebbca9fd04fcf1f589 /src/plugins/scripts/lua/weechat-lua.c
parente0c97562a596bcfde406fb26dbc8f9d5f0cde111 (diff)
downloadweechat-9373a7a47e4711e8db0549cec49da19db45330ae.zip
Added new plugin API function: remove_infobar
Diffstat (limited to 'src/plugins/scripts/lua/weechat-lua.c')
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index bd85daf68..798433c12 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -273,6 +273,39 @@ weechat_lua_print_infobar (lua_State *L)
}
/*
+ * weechat_lua_remove_infobar: remove message(s) in infobar
+ */
+
+static int
+weechat_lua_remove_infobar (lua_State *L)
+{
+ int n, how_many;
+ /* make gcc happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ lua_plugin->print_server (lua_plugin,
+ "Lua error: unable to remove infobar message(s), "
+ "script not initialized");
+ lua_pushnumber (lua_current_interpreter, 0);
+ return 1;
+ }
+
+ how_many = 0;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n == 1)
+ how_many = lua_tonumber (lua_current_interpreter, -1);
+
+ lua_plugin->infobar_remove (lua_plugin, how_many);
+
+ lua_pushnumber (lua_current_interpreter, 1);
+ return 1;
+}
+
+/*
* weechat_lua_print: log message in server/channel (current or specified ones)
*/
@@ -1365,6 +1398,7 @@ const struct luaL_reg weechat_lua_funcs[] = {
{ "register", weechat_lua_register},
{ "print", weechat_lua_print},
{ "print_infobar", weechat_lua_print_infobar},
+ { "remove_infobar", weechat_lua_remove_infobar},
{ "log", weechat_lua_log},
{ "command", weechat_lua_command},
{ "add_message_handler", weechat_lua_add_message_handler},