diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-28 14:36:49 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-28 14:36:49 +0200 |
commit | 1e4733b2375423916a5508537507e14db33a1493 (patch) | |
tree | 60260b5511ec3a43fd858932d534bcbfa9675c0e /src | |
parent | c78fabde1f572f28e0b1f2f71f358606ac943c01 (diff) | |
download | weechat-1e4733b2375423916a5508537507e14db33a1493.zip |
Added missing call to config hook when an option is "unset"
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config-file.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index a4ef78358..7dad5d34e 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -742,12 +742,14 @@ config_file_string_to_boolean (char *text) int config_file_option_reset (struct t_config_option *option, int run_callback) { - int rc; + int rc, length_option; + char value[256], *option_full_name; if (!option) return 0; rc = 0; + value[0] = '\0'; switch (option->type) { @@ -757,6 +759,9 @@ config_file_option_reset (struct t_config_option *option, int run_callback) else { CONFIG_BOOLEAN(option) = CONFIG_BOOLEAN_DEFAULT(option); + snprintf (value, sizeof (value), "%s", + CONFIG_BOOLEAN(option) ? + config_boolean_true[0] : config_boolean_false[0]); rc = 2; } break; @@ -766,6 +771,8 @@ config_file_option_reset (struct t_config_option *option, int run_callback) else { CONFIG_INTEGER(option) = CONFIG_INTEGER_DEFAULT(option); + snprintf (value, sizeof (value), "%d", + CONFIG_INTEGER(option)); rc = 2; } break; @@ -781,7 +788,12 @@ config_file_option_reset (struct t_config_option *option, int run_callback) if (option->default_value) { option->value = strdup ((char *)option->default_value); - if (!option->value) + if (option->value) + { + snprintf (value, sizeof (value), "%s", + CONFIG_STRING(option)); + } + else rc = 0; } else @@ -793,6 +805,8 @@ config_file_option_reset (struct t_config_option *option, int run_callback) else { CONFIG_COLOR(option) = CONFIG_COLOR_DEFAULT(option); + snprintf (value, sizeof (value), "%d", + CONFIG_COLOR(option)); rc = 2; } break; @@ -805,6 +819,26 @@ config_file_option_reset (struct t_config_option *option, int run_callback) (void)(option->callback_change)(option->callback_change_data, option); } + if (rc > 0) + { + if (option->config_file && option->section) + { + length_option = strlen (option->config_file->name) + 1 + + strlen (option->section->name) + 1 + strlen (option->name) + 1; + option_full_name = malloc (length_option); + if (option_full_name) + { + snprintf (option_full_name, length_option, + "%s.%s.%s", + option->config_file->name, + option->section->name, + option->name); + hook_config_exec (option_full_name, value); + free (option_full_name); + } + } + } + return 0; } |