diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-config-file.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 8cf646321..1e9b26bf8 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -3273,6 +3273,10 @@ config_file_parse_version (const char *version) * * Section can be updated only if option and value are NULL (ie if we are * reading a section line like "[section]"). + * + * Integer warning_update_displayed is set to 1 if a warning is displayed, + * when the file is updated to a newer version (then it's not compatible any + * more with previous versions). */ void @@ -3282,7 +3286,8 @@ config_file_update_data_read (struct t_config_file *config_file, const char *value, char **ret_section, char **ret_option, - char **ret_value) + char **ret_value, + int *warning_update_displayed) { struct t_hashtable *data_read, *hashtable; const char *ptr_section, *ptr_option, *ptr_value; @@ -3292,6 +3297,21 @@ config_file_update_data_read (struct t_config_file *config_file, if (config_file->version_read >= config_file->version) return; + if (!*warning_update_displayed + && (config_file->version_read < config_file->version)) + { + gui_chat_printf ( + NULL, + _("%sImportant: file %s has been updated from version %d to %d, " + "it is not compatible and can not be loaded any more with any " + "older version"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + config_file->filename, + config_file->version_read, + config_file->version); + *warning_update_displayed = 1; + } + /* do nothing if there's no update callback */ if (!config_file->callback_update) return; @@ -3389,6 +3409,7 @@ int config_file_read_internal (struct t_config_file *config_file, int reload) { int filename_length, line_number, rc, length, version; + int warning_update_displayed; char *filename, *section, *option, *value; struct t_config_section *ptr_section; struct t_config_option *ptr_option; @@ -3398,6 +3419,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload) return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; config_file->version_read = 1; + warning_update_displayed = 0; /* build filename */ filename_length = strlen (weechat_config_dir) + strlen (DIR_SEPARATOR) + @@ -3498,7 +3520,8 @@ config_file_read_internal (struct t_config_file *config_file, int reload) { config_file_update_data_read (config_file, section, NULL, NULL, - §ion, NULL, NULL); + §ion, NULL, NULL, + &warning_update_displayed); ptr_section = config_file_search_section (config_file, section); if (!ptr_section) @@ -3616,7 +3639,8 @@ config_file_read_internal (struct t_config_file *config_file, int reload) config_file_update_data_read (config_file, ptr_section->name, option, value, - NULL, &option, &value); + NULL, &option, &value, + &warning_update_displayed); /* option has been ignored by the update callback? */ if (!option || !option[0]) |