mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
script: add option script.look.quiet_actions (no messages when installing/removing/loading/unloading scripts on script buffer)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user