diff --git a/ChangeLog b/ChangeLog
index fa7ed9649..d6428f8e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2006-02-19
+ChangeLog - 2006-02-20
Version 0.1.8 (under dev!):
- * added timer handler for plugins
+ * added new plugins functions: add_timer_handler, remove_timer_handler,
+ remove_infobar
* plugin messages handlers now called when message is ignored (by /ignore)
* new behaviour for messages ignored by a message handler: now WeeChat
executes standard handler, treating message as "ignored"
diff --git a/doc/en/weechat.en.xml b/doc/en/weechat.en.xml
index a4e6f4b60..b807d35e9 100644
--- a/doc/en/weechat.en.xml
+++ b/doc/en/weechat.en.xml
@@ -3720,6 +3720,73 @@ weechat.print_infobar(5, "message")
+
+ remove_infobar
+
+
+ Perl prototype:
+
+ weechat::remove_infobar([count]);
+
+
+
+ Python prototype:
+
+ weechat.remove_infobar([count])
+
+
+
+ Ruby prototype:
+
+ Weechat.remove_infobar([count])
+
+
+
+ Lua prototype:
+
+ weechat.remove_infobar([count])
+
+
+
+ Remove one or more messages in infobar stack.
+
+
+ Arguments:
+
+
+
+ : number of messages to remove
+ (if argument not given or <= 0, then all messages are
+ removed)
+
+
+
+
+
+ Return value: 1 if success, 0 if an error occurred.
+
+
+ Examples:
+
+# perl
+weechat::remove_infobar(1);
+weechat::remove_infobar();
+
+# python
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+# ruby
+Weechat.remove_infobar(1)
+Weechat.remove_infobar()
+
+-- lua
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+
+
+
log
diff --git a/doc/fr/weechat.fr.xml b/doc/fr/weechat.fr.xml
index 37f6e3478..816ca7213 100644
--- a/doc/fr/weechat.fr.xml
+++ b/doc/fr/weechat.fr.xml
@@ -3790,6 +3790,73 @@ weechat.print_infobar(5, "message")
+
+ remove_infobar
+
+
+ Prototype Perl :
+
+ weechat::remove_infobar([nombre]);
+
+
+
+ Prototype Python :
+
+ weechat.remove_infobar([nombre])
+
+
+
+ Prototype Ruby :
+
+ Weechat.remove_infobar([nombre])
+
+
+
+ Prototype Lua :
+
+ weechat.remove_infobar([nombre])
+
+
+
+ Efface un ou plusieurs messages dans la pile de la barre d'infos.
+
+
+ Paramètres :
+
+
+
+ : nombre de messages à supprimer
+ (si paramètre non présent ou <= 0, alors tous les messages
+ sont effacés)
+
+
+
+
+
+ Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
+
+
+ Exemples :
+
+# perl
+weechat::remove_infobar(1);
+weechat::remove_infobar();
+
+# python
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+# ruby
+Weechat.remove_infobar(1)
+Weechat.remove_infobar()
+
+-- lua
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+
+
+
log
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index 52545c3ac..719ad340a 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -1103,12 +1103,10 @@ gui_infobar_printf_from_buffer (t_gui_buffer *buffer, int time_displayed,
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0);
- weechat_log_printf ("avant decodage: %s\n", buf);
if (buf2)
buf3 = channel_iconv_decode (SERVER(buffer), CHANNEL(buffer), buf2);
else
buf3 = NULL;
- weechat_log_printf ("apres decodage: %s\n", buf3);
gui_infobar_printf (time_displayed, color,
"%s%s", message1,
@@ -1139,6 +1137,19 @@ gui_infobar_remove ()
}
}
+/*
+ * gui_infobar_remove_all: remove last displayed message in infobar
+ */
+
+void
+gui_infobar_remove_all ()
+{
+ while (gui_infobar)
+ {
+ gui_infobar_remove ();
+ }
+}
+
/*
* gui_optimize_input_buffer_size: optimize input buffer size by adding
* or deleting data block (predefined size)
diff --git a/src/gui/gui.h b/src/gui/gui.h
index f05ee22f6..e9fa66dc4 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -408,10 +408,11 @@ extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
extern void gui_buffer_clear (t_gui_buffer *);
extern void gui_buffer_clear_all ();
+extern void gui_window_free (t_gui_window *);
extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_printf_from_buffer (t_gui_buffer *, int, int, char *, char *, ...);
-extern void gui_window_free (t_gui_window *);
extern void gui_infobar_remove ();
+extern void gui_infobar_remove_all ();
extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_line_new (t_gui_buffer *);
extern int gui_word_strlen (t_gui_window *, char *);
diff --git a/src/plugins/plugins-interface.c b/src/plugins/plugins-interface.c
index e7f88712f..ab2d677bc 100644
--- a/src/plugins/plugins-interface.c
+++ b/src/plugins/plugins-interface.c
@@ -214,6 +214,29 @@ weechat_plugin_print_infobar (t_weechat_plugin *plugin, int time_displayed, char
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, "%s", buf);
}
+/*
+ * weechat_plugin_infobar_remove: remove message(s) in infobar
+ */
+
+void
+weechat_plugin_infobar_remove (t_weechat_plugin *plugin, int how_many)
+{
+ if (!plugin)
+ return;
+
+ if (how_many <= 0)
+ gui_infobar_remove_all ();
+ else
+ {
+ while ((gui_infobar) && (how_many > 0))
+ {
+ gui_infobar_remove ();
+ how_many--;
+ }
+ }
+ gui_draw_buffer_infobar (gui_current_window->buffer, 1);
+}
+
/*
* weechat_plugin_log: add a message on logs
*/
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index 440034650..305a64af3 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -731,6 +731,7 @@ plugin_load (char *filename)
new_plugin->print = &weechat_plugin_print;
new_plugin->print_server = &weechat_plugin_print_server;
new_plugin->print_infobar = &weechat_plugin_print_infobar;
+ new_plugin->infobar_remove = &weechat_plugin_infobar_remove;
new_plugin->log = &weechat_plugin_log;
new_plugin->exec_command = &weechat_plugin_exec_command;
new_plugin->get_info = &weechat_plugin_get_info;
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
@@ -272,6 +272,39 @@ weechat_lua_print_infobar (lua_State *L)
return 1;
}
+/*
+ * 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},
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index d6eaa27f4..f8c581480 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -336,6 +336,31 @@ static XS (XS_weechat_print_infobar)
XSRETURN_YES;
}
+/*
+ * weechat::remove_infobar: remove message(s) from infobar
+ */
+
+static XS (XS_weechat_remove_infobar)
+{
+ dXSARGS;
+
+ /* make gcc happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ perl_plugin->print_server (perl_plugin,
+ "Perl error: unable to remove infobar message(s), "
+ "script not initialized");
+ XSRETURN_NO;
+ }
+
+ perl_plugin->infobar_remove (perl_plugin,
+ (items >= 1) ? SvIV (ST (0)) : 0);
+
+ XSRETURN_YES;
+}
+
/*
* weechat::log: log message in server/channel (current or specified ones)
*/
@@ -1160,6 +1185,7 @@ weechat_perl_xs_init (pTHX)
newXS ("weechat::register", XS_weechat_register, "weechat");
newXS ("weechat::print", XS_weechat_print, "weechat");
newXS ("weechat::print_infobar", XS_weechat_print_infobar, "weechat");
+ newXS ("weechat::remove_infobar", XS_weechat_remove_infobar, "weechat");
newXS ("weechat::log", XS_weechat_log, "weechat");
newXS ("weechat::command", XS_weechat_command, "weechat");
newXS ("weechat::add_message_handler", XS_weechat_add_message_handler, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 07576f1a0..b7afb327a 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -247,6 +247,41 @@ weechat_python_print_infobar (PyObject *self, PyObject *args)
return Py_BuildValue ("i", 1);
}
+/*
+ * weechat_python_remove_infobar: remove message(s) from infobar
+ */
+
+static PyObject *
+weechat_python_remove_infobar (PyObject *self, PyObject *args)
+{
+ int how_many;
+
+ /* make gcc happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ python_plugin->print_server (python_plugin,
+ "Python error: unable to remove infobar message(s), "
+ "script not initialized");
+ return Py_BuildValue ("i", 0);
+ }
+
+ how_many = 0;
+
+ if (!PyArg_ParseTuple (args, "|is", &how_many))
+ {
+ python_plugin->print_server (python_plugin,
+ "Python error: wrong parameters for "
+ "\"infobar_remove\" function");
+ return Py_BuildValue ("i", 0);
+ }
+
+ python_plugin->infobar_remove (python_plugin, how_many);
+
+ return Py_BuildValue ("i", 1);
+}
+
/*
* weechat_python_log: log message in server/channel (current or specified ones)
*/
@@ -1091,6 +1126,7 @@ PyMethodDef weechat_python_funcs[] = {
{ "register", weechat_python_register, METH_VARARGS, "" },
{ "prnt", weechat_python_print, METH_VARARGS, "" },
{ "print_infobar", weechat_python_print_infobar, METH_VARARGS, "" },
+ { "remove_infobar", weechat_python_remove_infobar, METH_VARARGS, "" },
{ "log", weechat_python_log, METH_VARARGS, "" },
{ "command", weechat_python_command, METH_VARARGS, "" },
{ "add_message_handler", weechat_python_add_message_handler, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index 11b3f8efd..19b7ccce6 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -319,6 +319,44 @@ weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
return INT2FIX (1);
}
+/*
+ * weechat_ruby_remove_infobar: remove message(s) from infobar
+ */
+
+static VALUE
+weechat_ruby_remove_infobar (int argc, VALUE *argv, VALUE class)
+{
+ VALUE how_many;
+ int c_how_many;
+
+ /* make gcc happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ ruby_plugin->print_server (ruby_plugin,
+ "Ruby error: unable to remove infobar message(s), "
+ "script not initialized");
+ return INT2FIX (0);
+ }
+
+ how_many = Qnil;
+
+ rb_scan_args (argc, argv, "01", &how_many);
+
+ if (!NIL_P (how_many))
+ {
+ Check_Type (how_many, T_FIXNUM);
+ c_how_many = FIX2INT (how_many);
+ }
+ else
+ c_how_many = 0;
+
+ ruby_plugin->infobar_remove (ruby_plugin, c_how_many);
+
+ return INT2FIX (1);
+}
+
/*
* weechat_ruby_log: log message in server/channel (current or specified ones)
*/
@@ -1713,6 +1751,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
rb_define_module_function (mWeechat, "register", weechat_ruby_register, 4);
rb_define_module_function (mWeechat, "print", weechat_ruby_print, -1);
rb_define_module_function (mWeechat, "print_infobar", weechat_ruby_print_infobar, 2);
+ rb_define_module_function (mWeechat, "remove_infobar", weechat_ruby_remove_infobar, -1);
rb_define_module_function (mWeechat, "log", weechat_ruby_log, -1);
rb_define_module_function (mWeechat, "command", weechat_ruby_command, -1);
rb_define_module_function (mWeechat, "add_message_handler", weechat_ruby_add_message_handler, 2);
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 5d980675f..57c01644c 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -206,6 +206,7 @@ struct t_weechat_plugin
void (*print) (t_weechat_plugin *, char *, char *, char *, ...);
void (*print_server) (t_weechat_plugin *, char *, ...);
void (*print_infobar) (t_weechat_plugin *, int, char *, ...);
+ void (*infobar_remove) (t_weechat_plugin *, int);
t_plugin_handler *(*msg_handler_add) (t_weechat_plugin *, char *,
t_plugin_handler_func *,
@@ -254,6 +255,7 @@ extern void weechat_plugin_exec_on_files (t_weechat_plugin *, char *,
extern void weechat_plugin_print (t_weechat_plugin *, char *, char *, char *, ...);
extern void weechat_plugin_print_server (t_weechat_plugin *, char *, ...);
extern void weechat_plugin_print_infobar (t_weechat_plugin *, int, char *, ...);
+extern void weechat_plugin_infobar_remove (t_weechat_plugin *, int);
/* log functions */
extern void weechat_plugin_log (t_weechat_plugin *, char *, char *, char *, ...);
diff --git a/weechat/ChangeLog b/weechat/ChangeLog
index fa7ed9649..d6428f8e5 100644
--- a/weechat/ChangeLog
+++ b/weechat/ChangeLog
@@ -1,11 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2006-02-19
+ChangeLog - 2006-02-20
Version 0.1.8 (under dev!):
- * added timer handler for plugins
+ * added new plugins functions: add_timer_handler, remove_timer_handler,
+ remove_infobar
* plugin messages handlers now called when message is ignored (by /ignore)
* new behaviour for messages ignored by a message handler: now WeeChat
executes standard handler, treating message as "ignored"
diff --git a/weechat/doc/en/weechat.en.xml b/weechat/doc/en/weechat.en.xml
index a4e6f4b60..b807d35e9 100644
--- a/weechat/doc/en/weechat.en.xml
+++ b/weechat/doc/en/weechat.en.xml
@@ -3720,6 +3720,73 @@ weechat.print_infobar(5, "message")
+
+ remove_infobar
+
+
+ Perl prototype:
+
+ weechat::remove_infobar([count]);
+
+
+
+ Python prototype:
+
+ weechat.remove_infobar([count])
+
+
+
+ Ruby prototype:
+
+ Weechat.remove_infobar([count])
+
+
+
+ Lua prototype:
+
+ weechat.remove_infobar([count])
+
+
+
+ Remove one or more messages in infobar stack.
+
+
+ Arguments:
+
+
+
+ : number of messages to remove
+ (if argument not given or <= 0, then all messages are
+ removed)
+
+
+
+
+
+ Return value: 1 if success, 0 if an error occurred.
+
+
+ Examples:
+
+# perl
+weechat::remove_infobar(1);
+weechat::remove_infobar();
+
+# python
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+# ruby
+Weechat.remove_infobar(1)
+Weechat.remove_infobar()
+
+-- lua
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+
+
+
log
diff --git a/weechat/doc/fr/weechat.fr.xml b/weechat/doc/fr/weechat.fr.xml
index 37f6e3478..816ca7213 100644
--- a/weechat/doc/fr/weechat.fr.xml
+++ b/weechat/doc/fr/weechat.fr.xml
@@ -3790,6 +3790,73 @@ weechat.print_infobar(5, "message")
+
+ remove_infobar
+
+
+ Prototype Perl :
+
+ weechat::remove_infobar([nombre]);
+
+
+
+ Prototype Python :
+
+ weechat.remove_infobar([nombre])
+
+
+
+ Prototype Ruby :
+
+ Weechat.remove_infobar([nombre])
+
+
+
+ Prototype Lua :
+
+ weechat.remove_infobar([nombre])
+
+
+
+ Efface un ou plusieurs messages dans la pile de la barre d'infos.
+
+
+ Paramètres :
+
+
+
+ : nombre de messages à supprimer
+ (si paramètre non présent ou <= 0, alors tous les messages
+ sont effacés)
+
+
+
+
+
+ Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
+
+
+ Exemples :
+
+# perl
+weechat::remove_infobar(1);
+weechat::remove_infobar();
+
+# python
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+# ruby
+Weechat.remove_infobar(1)
+Weechat.remove_infobar()
+
+-- lua
+weechat.remove_infobar(1)
+weechat.remove_infobar()
+
+
+
+
log
diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c
index 52545c3ac..719ad340a 100644
--- a/weechat/src/gui/gui-common.c
+++ b/weechat/src/gui/gui-common.c
@@ -1103,12 +1103,10 @@ gui_infobar_printf_from_buffer (t_gui_buffer *buffer, int time_displayed,
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0);
- weechat_log_printf ("avant decodage: %s\n", buf);
if (buf2)
buf3 = channel_iconv_decode (SERVER(buffer), CHANNEL(buffer), buf2);
else
buf3 = NULL;
- weechat_log_printf ("apres decodage: %s\n", buf3);
gui_infobar_printf (time_displayed, color,
"%s%s", message1,
@@ -1139,6 +1137,19 @@ gui_infobar_remove ()
}
}
+/*
+ * gui_infobar_remove_all: remove last displayed message in infobar
+ */
+
+void
+gui_infobar_remove_all ()
+{
+ while (gui_infobar)
+ {
+ gui_infobar_remove ();
+ }
+}
+
/*
* gui_optimize_input_buffer_size: optimize input buffer size by adding
* or deleting data block (predefined size)
diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h
index f05ee22f6..e9fa66dc4 100644
--- a/weechat/src/gui/gui.h
+++ b/weechat/src/gui/gui.h
@@ -408,10 +408,11 @@ extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
extern void gui_buffer_clear (t_gui_buffer *);
extern void gui_buffer_clear_all ();
+extern void gui_window_free (t_gui_window *);
extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_printf_from_buffer (t_gui_buffer *, int, int, char *, char *, ...);
-extern void gui_window_free (t_gui_window *);
extern void gui_infobar_remove ();
+extern void gui_infobar_remove_all ();
extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_line_new (t_gui_buffer *);
extern int gui_word_strlen (t_gui_window *, char *);
diff --git a/weechat/src/plugins/plugins-interface.c b/weechat/src/plugins/plugins-interface.c
index e7f88712f..ab2d677bc 100644
--- a/weechat/src/plugins/plugins-interface.c
+++ b/weechat/src/plugins/plugins-interface.c
@@ -214,6 +214,29 @@ weechat_plugin_print_infobar (t_weechat_plugin *plugin, int time_displayed, char
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, "%s", buf);
}
+/*
+ * weechat_plugin_infobar_remove: remove message(s) in infobar
+ */
+
+void
+weechat_plugin_infobar_remove (t_weechat_plugin *plugin, int how_many)
+{
+ if (!plugin)
+ return;
+
+ if (how_many <= 0)
+ gui_infobar_remove_all ();
+ else
+ {
+ while ((gui_infobar) && (how_many > 0))
+ {
+ gui_infobar_remove ();
+ how_many--;
+ }
+ }
+ gui_draw_buffer_infobar (gui_current_window->buffer, 1);
+}
+
/*
* weechat_plugin_log: add a message on logs
*/
diff --git a/weechat/src/plugins/plugins.c b/weechat/src/plugins/plugins.c
index 440034650..305a64af3 100644
--- a/weechat/src/plugins/plugins.c
+++ b/weechat/src/plugins/plugins.c
@@ -731,6 +731,7 @@ plugin_load (char *filename)
new_plugin->print = &weechat_plugin_print;
new_plugin->print_server = &weechat_plugin_print_server;
new_plugin->print_infobar = &weechat_plugin_print_infobar;
+ new_plugin->infobar_remove = &weechat_plugin_infobar_remove;
new_plugin->log = &weechat_plugin_log;
new_plugin->exec_command = &weechat_plugin_exec_command;
new_plugin->get_info = &weechat_plugin_get_info;
diff --git a/weechat/src/plugins/scripts/lua/weechat-lua.c b/weechat/src/plugins/scripts/lua/weechat-lua.c
index bd85daf68..798433c12 100644
--- a/weechat/src/plugins/scripts/lua/weechat-lua.c
+++ b/weechat/src/plugins/scripts/lua/weechat-lua.c
@@ -272,6 +272,39 @@ weechat_lua_print_infobar (lua_State *L)
return 1;
}
+/*
+ * 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},
diff --git a/weechat/src/plugins/scripts/perl/weechat-perl.c b/weechat/src/plugins/scripts/perl/weechat-perl.c
index d6eaa27f4..f8c581480 100644
--- a/weechat/src/plugins/scripts/perl/weechat-perl.c
+++ b/weechat/src/plugins/scripts/perl/weechat-perl.c
@@ -336,6 +336,31 @@ static XS (XS_weechat_print_infobar)
XSRETURN_YES;
}
+/*
+ * weechat::remove_infobar: remove message(s) from infobar
+ */
+
+static XS (XS_weechat_remove_infobar)
+{
+ dXSARGS;
+
+ /* make gcc happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ perl_plugin->print_server (perl_plugin,
+ "Perl error: unable to remove infobar message(s), "
+ "script not initialized");
+ XSRETURN_NO;
+ }
+
+ perl_plugin->infobar_remove (perl_plugin,
+ (items >= 1) ? SvIV (ST (0)) : 0);
+
+ XSRETURN_YES;
+}
+
/*
* weechat::log: log message in server/channel (current or specified ones)
*/
@@ -1160,6 +1185,7 @@ weechat_perl_xs_init (pTHX)
newXS ("weechat::register", XS_weechat_register, "weechat");
newXS ("weechat::print", XS_weechat_print, "weechat");
newXS ("weechat::print_infobar", XS_weechat_print_infobar, "weechat");
+ newXS ("weechat::remove_infobar", XS_weechat_remove_infobar, "weechat");
newXS ("weechat::log", XS_weechat_log, "weechat");
newXS ("weechat::command", XS_weechat_command, "weechat");
newXS ("weechat::add_message_handler", XS_weechat_add_message_handler, "weechat");
diff --git a/weechat/src/plugins/scripts/python/weechat-python.c b/weechat/src/plugins/scripts/python/weechat-python.c
index 07576f1a0..b7afb327a 100644
--- a/weechat/src/plugins/scripts/python/weechat-python.c
+++ b/weechat/src/plugins/scripts/python/weechat-python.c
@@ -247,6 +247,41 @@ weechat_python_print_infobar (PyObject *self, PyObject *args)
return Py_BuildValue ("i", 1);
}
+/*
+ * weechat_python_remove_infobar: remove message(s) from infobar
+ */
+
+static PyObject *
+weechat_python_remove_infobar (PyObject *self, PyObject *args)
+{
+ int how_many;
+
+ /* make gcc happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ python_plugin->print_server (python_plugin,
+ "Python error: unable to remove infobar message(s), "
+ "script not initialized");
+ return Py_BuildValue ("i", 0);
+ }
+
+ how_many = 0;
+
+ if (!PyArg_ParseTuple (args, "|is", &how_many))
+ {
+ python_plugin->print_server (python_plugin,
+ "Python error: wrong parameters for "
+ "\"infobar_remove\" function");
+ return Py_BuildValue ("i", 0);
+ }
+
+ python_plugin->infobar_remove (python_plugin, how_many);
+
+ return Py_BuildValue ("i", 1);
+}
+
/*
* weechat_python_log: log message in server/channel (current or specified ones)
*/
@@ -1091,6 +1126,7 @@ PyMethodDef weechat_python_funcs[] = {
{ "register", weechat_python_register, METH_VARARGS, "" },
{ "prnt", weechat_python_print, METH_VARARGS, "" },
{ "print_infobar", weechat_python_print_infobar, METH_VARARGS, "" },
+ { "remove_infobar", weechat_python_remove_infobar, METH_VARARGS, "" },
{ "log", weechat_python_log, METH_VARARGS, "" },
{ "command", weechat_python_command, METH_VARARGS, "" },
{ "add_message_handler", weechat_python_add_message_handler, METH_VARARGS, "" },
diff --git a/weechat/src/plugins/scripts/ruby/weechat-ruby.c b/weechat/src/plugins/scripts/ruby/weechat-ruby.c
index 11b3f8efd..19b7ccce6 100644
--- a/weechat/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/weechat/src/plugins/scripts/ruby/weechat-ruby.c
@@ -319,6 +319,44 @@ weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
return INT2FIX (1);
}
+/*
+ * weechat_ruby_remove_infobar: remove message(s) from infobar
+ */
+
+static VALUE
+weechat_ruby_remove_infobar (int argc, VALUE *argv, VALUE class)
+{
+ VALUE how_many;
+ int c_how_many;
+
+ /* make gcc happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ ruby_plugin->print_server (ruby_plugin,
+ "Ruby error: unable to remove infobar message(s), "
+ "script not initialized");
+ return INT2FIX (0);
+ }
+
+ how_many = Qnil;
+
+ rb_scan_args (argc, argv, "01", &how_many);
+
+ if (!NIL_P (how_many))
+ {
+ Check_Type (how_many, T_FIXNUM);
+ c_how_many = FIX2INT (how_many);
+ }
+ else
+ c_how_many = 0;
+
+ ruby_plugin->infobar_remove (ruby_plugin, c_how_many);
+
+ return INT2FIX (1);
+}
+
/*
* weechat_ruby_log: log message in server/channel (current or specified ones)
*/
@@ -1713,6 +1751,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
rb_define_module_function (mWeechat, "register", weechat_ruby_register, 4);
rb_define_module_function (mWeechat, "print", weechat_ruby_print, -1);
rb_define_module_function (mWeechat, "print_infobar", weechat_ruby_print_infobar, 2);
+ rb_define_module_function (mWeechat, "remove_infobar", weechat_ruby_remove_infobar, -1);
rb_define_module_function (mWeechat, "log", weechat_ruby_log, -1);
rb_define_module_function (mWeechat, "command", weechat_ruby_command, -1);
rb_define_module_function (mWeechat, "add_message_handler", weechat_ruby_add_message_handler, 2);
diff --git a/weechat/src/plugins/weechat-plugin.h b/weechat/src/plugins/weechat-plugin.h
index 5d980675f..57c01644c 100644
--- a/weechat/src/plugins/weechat-plugin.h
+++ b/weechat/src/plugins/weechat-plugin.h
@@ -206,6 +206,7 @@ struct t_weechat_plugin
void (*print) (t_weechat_plugin *, char *, char *, char *, ...);
void (*print_server) (t_weechat_plugin *, char *, ...);
void (*print_infobar) (t_weechat_plugin *, int, char *, ...);
+ void (*infobar_remove) (t_weechat_plugin *, int);
t_plugin_handler *(*msg_handler_add) (t_weechat_plugin *, char *,
t_plugin_handler_func *,
@@ -254,6 +255,7 @@ extern void weechat_plugin_exec_on_files (t_weechat_plugin *, char *,
extern void weechat_plugin_print (t_weechat_plugin *, char *, char *, char *, ...);
extern void weechat_plugin_print_server (t_weechat_plugin *, char *, ...);
extern void weechat_plugin_print_infobar (t_weechat_plugin *, int, char *, ...);
+extern void weechat_plugin_infobar_remove (t_weechat_plugin *, int);
/* log functions */
extern void weechat_plugin_log (t_weechat_plugin *, char *, char *, char *, ...);