mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 09:13:14 +02:00
core: run config hooks only when value or default value is actually changed in set/reset/unset functions
This commit is contained in:
@@ -40,6 +40,7 @@ Bug fixes::
|
||||
|
||||
* core: display a specific error when trying to bind a key without area in mouse context
|
||||
* core: fix display of key with command `/key bindctxt <context> <key>`
|
||||
* core: run config hooks only when value or default value is actually changed in set/reset/unset functions
|
||||
* core: fix crash in case of NULL message sent to function gui_chat_printf_y_date_tags (issue #1883)
|
||||
* core: allow command `/input move_next_word` going to the end of line (issue #1881)
|
||||
* core: ignore incomplete ctrl/meta/meta2 codes in keys
|
||||
|
||||
+38
-57
@@ -530,7 +530,7 @@ config_file_hook_config_exec (struct t_config_option *option)
|
||||
{
|
||||
char *option_full_name, str_value[256];
|
||||
|
||||
if (!option)
|
||||
if (!option || !option->config_file || !option->section)
|
||||
return;
|
||||
|
||||
option_full_name = config_file_option_full_name (option);
|
||||
@@ -966,11 +966,7 @@ config_file_new_option (struct t_config_file *config_file,
|
||||
new_option->next_option = NULL;
|
||||
}
|
||||
|
||||
/* run config hook(s) */
|
||||
if (new_option->config_file && new_option->section)
|
||||
{
|
||||
config_file_hook_config_exec (new_option);
|
||||
}
|
||||
config_file_hook_config_exec (new_option);
|
||||
}
|
||||
|
||||
goto end;
|
||||
@@ -1353,19 +1349,16 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
|
||||
}
|
||||
}
|
||||
|
||||
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
&& run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
|
||||
/* run config hook(s) */
|
||||
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
&& option->config_file && option->section)
|
||||
/* run callback and config hook(s) if value was changed */
|
||||
if (rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
{
|
||||
if (run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
config_file_hook_config_exec (option);
|
||||
}
|
||||
|
||||
@@ -1678,20 +1671,16 @@ config_file_option_set (struct t_config_option *option, const char *value,
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
}
|
||||
|
||||
/* run callback if asked and value was changed */
|
||||
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
&& run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
|
||||
/* run config hook(s) */
|
||||
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
&& option->config_file && option->section)
|
||||
/* run callback and config hook(s) if value was changed */
|
||||
if (rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
{
|
||||
if (run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
config_file_hook_config_exec (option);
|
||||
}
|
||||
|
||||
@@ -1836,20 +1825,16 @@ config_file_option_set_null (struct t_config_option *option, int run_callback)
|
||||
}
|
||||
}
|
||||
|
||||
/* run callback if asked and value was changed */
|
||||
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
&& run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
|
||||
/* run config hook(s) */
|
||||
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
&& option->config_file && option->section)
|
||||
/* run callback and config hook(s) if value was changed */
|
||||
if (rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
{
|
||||
if (run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
config_file_hook_config_exec (option);
|
||||
}
|
||||
|
||||
@@ -2163,20 +2148,16 @@ config_file_option_set_default (struct t_config_option *option,
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
|
||||
}
|
||||
|
||||
/* run callback if asked and value was changed */
|
||||
if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
&& run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
|
||||
/* run config hook(s) */
|
||||
if ((rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
&& option->config_file && option->section)
|
||||
/* run callback and config hook(s) if default value was changed */
|
||||
if (rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED)
|
||||
{
|
||||
if (run_callback && option->callback_change)
|
||||
{
|
||||
(void) (option->callback_change) (
|
||||
option->callback_change_pointer,
|
||||
option->callback_change_data,
|
||||
option);
|
||||
}
|
||||
config_file_hook_config_exec (option);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user