summaryrefslogtreecommitdiff
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-08-21 18:57:49 +0200
committerSebastien Helleu <flashcode@flashtux.org>2012-08-21 18:57:49 +0200
commit129f32ce8ed0fb6d8b37ed945455144bd83ce95a (patch)
tree2c3d13d11fdf260df5a1949884eb4fc3061ccaf4 /src/plugins/lua
parentcc5118b3b6726d8fc8bf087eea59e474a838896b (diff)
downloadweechat-129f32ce8ed0fb6d8b37ed945455144bd83ce95a.zip
script: add option script.look.quiet_actions (no messages when installing/removing/loading/unloading scripts on script buffer)
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/weechat-lua.c72
1 files changed, 48 insertions, 24 deletions
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index eed431cdf..89cede0b8 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -461,9 +461,12 @@ weechat_lua_unload_name (const char *name)
if (ptr_script)
{
weechat_lua_unload (ptr_script);
- weechat_printf (NULL,
- weechat_gettext ("%s: script \"%s\" unloaded"),
- LUA_PLUGIN_NAME, name);
+ if (!lua_quiet)
+ {
+ weechat_printf (NULL,
+ weechat_gettext ("%s: script \"%s\" unloaded"),
+ LUA_PLUGIN_NAME, name);
+ }
}
else
{
@@ -490,9 +493,12 @@ weechat_lua_reload_name (const char *name)
if (filename)
{
weechat_lua_unload (ptr_script);
- weechat_printf (NULL,
- weechat_gettext ("%s: script \"%s\" unloaded"),
- LUA_PLUGIN_NAME, name);
+ if (!lua_quiet)
+ {
+ weechat_printf (NULL,
+ weechat_gettext ("%s: script \"%s\" unloaded"),
+ LUA_PLUGIN_NAME, name);
+ }
weechat_lua_load (filename);
free (filename);
}
@@ -526,7 +532,7 @@ int
weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- char *path_script;
+ char *ptr_name, *path_script;
/* make C compiler happy */
(void) data;
@@ -575,24 +581,40 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
plugin_script_display_list (weechat_lua_plugin, lua_scripts,
argv_eol[2], 1);
}
- else if (weechat_strcasecmp (argv[1], "load") == 0)
+ else if ((weechat_strcasecmp (argv[1], "load") == 0)
+ || (weechat_strcasecmp (argv[1], "reload") == 0)
+ || (weechat_strcasecmp (argv[1], "unload") == 0))
{
- /* load Lua script */
- path_script = plugin_script_search_path (weechat_lua_plugin,
- argv_eol[2]);
- weechat_lua_load ((path_script) ? path_script : argv_eol[2]);
- if (path_script)
- free (path_script);
- }
- else if (weechat_strcasecmp (argv[1], "reload") == 0)
- {
- /* reload one Lua script */
- weechat_lua_reload_name (argv_eol[2]);
- }
- else if (weechat_strcasecmp (argv[1], "unload") == 0)
- {
- /* unload Lua script */
- weechat_lua_unload_name (argv_eol[2]);
+ ptr_name = argv_eol[2];
+ if (strncmp (ptr_name, "-q ", 3) == 0)
+ {
+ lua_quiet = 1;
+ ptr_name += 3;
+ while (ptr_name[0] == ' ')
+ {
+ ptr_name++;
+ }
+ }
+ if (weechat_strcasecmp (argv[1], "load") == 0)
+ {
+ /* load Lua script */
+ path_script = plugin_script_search_path (weechat_lua_plugin,
+ ptr_name);
+ weechat_lua_load ((path_script) ? path_script : ptr_name);
+ if (path_script)
+ free (path_script);
+ }
+ else if (weechat_strcasecmp (argv[1], "reload") == 0)
+ {
+ /* reload one Lua script */
+ weechat_lua_reload_name (ptr_name);
+ }
+ else if (weechat_strcasecmp (argv[1], "unload") == 0)
+ {
+ /* unload Lua script */
+ weechat_lua_unload_name (ptr_name);
+ }
+ lua_quiet = 0;
}
else
{
@@ -723,6 +745,7 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
lua_scripts,
&weechat_lua_unload,
&weechat_lua_load,
+ &lua_quiet,
&lua_action_install_list);
}
else if (data == &lua_action_remove_list)
@@ -730,6 +753,7 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
plugin_script_action_remove (weechat_lua_plugin,
lua_scripts,
&weechat_lua_unload,
+ &lua_quiet,
&lua_action_remove_list);
}
}