1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 06:46:38 +02:00

scripts: fix reset of "quiet" status in case of nested calls (issue #2046, issue #2126)

This commit is contained in:
Sébastien Helleu
2024-06-26 18:09:12 +02:00
parent dc283dd1c7
commit 3d3d8f2ea7
8 changed files with 110 additions and 43 deletions
+11 -4
View File
@@ -574,7 +574,7 @@ weechat_tcl_command_cb (const void *pointer, void *data,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *ptr_code, *path_script;
int i, send_to_buffer_as_input, exec_commands;
int i, send_to_buffer_as_input, exec_commands, old_tcl_quiet;
/* make C compiler happy */
(void) pointer;
@@ -633,6 +633,7 @@ weechat_tcl_command_cb (const void *pointer, void *data,
|| (weechat_strcmp (argv[1], "reload") == 0)
|| (weechat_strcmp (argv[1], "unload") == 0))
{
old_tcl_quiet = tcl_quiet;
ptr_name = argv_eol[2];
if (strncmp (ptr_name, "-q ", 3) == 0)
{
@@ -662,7 +663,7 @@ weechat_tcl_command_cb (const void *pointer, void *data,
/* unload tcl script */
weechat_tcl_unload_name (ptr_name);
}
tcl_quiet = 0;
tcl_quiet = old_tcl_quiet;
}
else if (weechat_strcmp (argv[1], "eval") == 0)
{
@@ -910,6 +911,8 @@ weechat_tcl_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
int old_tcl_quiet;
/* make C compiler happy */
(void) argc;
(void) argv;
@@ -947,9 +950,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
tcl_data.callback_load_file = &weechat_tcl_load_cb;
tcl_data.unload_all = &weechat_tcl_unload_all;
old_tcl_quiet = tcl_quiet;
tcl_quiet = 1;
plugin_script_init (weechat_tcl_plugin, &tcl_data);
tcl_quiet = 0;
tcl_quiet = old_tcl_quiet;
plugin_script_display_short_list (weechat_tcl_plugin,
tcl_scripts);
@@ -965,7 +969,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
int old_tcl_quiet;
/* unload all scripts */
old_tcl_quiet = tcl_quiet;
tcl_quiet = 1;
if (tcl_script_eval)
{
@@ -973,7 +980,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
tcl_script_eval = NULL;
}
plugin_script_end (plugin, &tcl_data);
tcl_quiet = 0;
tcl_quiet = old_tcl_quiet;
/* free some data */
if (tcl_action_install_list)