1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 12:26:40 +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
@@ -870,7 +870,7 @@ weechat_php_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_php_quiet;
/* make C compiler happy */
(void) pointer;
@@ -929,6 +929,7 @@ weechat_php_command_cb (const void *pointer, void *data,
|| (weechat_strcmp (argv[1], "reload") == 0)
|| (weechat_strcmp (argv[1], "unload") == 0))
{
old_php_quiet = php_quiet;
ptr_name = argv_eol[2];
if (strncmp (ptr_name, "-q ", 3) == 0)
{
@@ -958,7 +959,7 @@ weechat_php_command_cb (const void *pointer, void *data,
/* unload PHP script */
weechat_php_unload_name (ptr_name);
}
php_quiet = 0;
php_quiet = old_php_quiet;
}
else if (weechat_strcmp (argv[1], "eval") == 0)
{
@@ -1267,6 +1268,8 @@ php_weechat_log_message (char *message)
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
int old_php_quiet;
/* make C compiler happy */
(void) argc;
(void) argv;
@@ -1314,9 +1317,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
PG(report_zend_debug) = 0; /* Turn off --enable-debug output */
old_php_quiet = php_quiet;
php_quiet = 1;
plugin_script_init (weechat_php_plugin, &php_data);
php_quiet = 0;
php_quiet = old_php_quiet;
plugin_script_display_short_list (weechat_php_plugin,
php_scripts);
@@ -1332,7 +1336,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
int old_php_quiet;
/* unload all scripts */
old_php_quiet = php_quiet;
php_quiet = 1;
if (php_script_eval)
{
@@ -1340,7 +1347,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
php_script_eval = NULL;
}
plugin_script_end (plugin, &php_data);
php_quiet = 0;
php_quiet = old_php_quiet;
if (weechat_php_func_map)
{