diff options
Diffstat (limited to 'src/fe-common/core/fe-settings.c')
-rw-r--r-- | src/fe-common/core/fe-settings.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index 71ec1bf1..1bf0a954 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -274,24 +274,32 @@ static void settings_save_confirm(const char *line, char *fname) /* SYNTAX: SAVE [<file>] */ static void cmd_save(const char *data) { - char *format; - - if (*data == '\0') - data = mainconfig->fname; + GHashTable *optlist; + char *format, *fname; + void *free_arg; - if (!irssi_config_is_changed(data)) { - settings_save_fe(data); + if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, + "save", &optlist, &fname)) return; - } - printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, - TXT_CONFIG_MODIFIED, data); + if (*fname == '\0') + fname = mainconfig->fname; + + if (!irssi_config_is_changed(fname)) + settings_save_fe(fname); + else { + /* config file modified outside irssi */ + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, + TXT_CONFIG_MODIFIED, fname); + + format = format_get_text(MODULE_NAME, NULL, NULL, NULL, + TXT_OVERWRITE_CONFIG); + keyboard_entry_redirect((SIGNAL_FUNC) settings_save_confirm, + format, 0, g_strdup(fname)); + g_free(format); + } - format = format_get_text(MODULE_NAME, NULL, NULL, NULL, - TXT_OVERWRITE_CONFIG); - keyboard_entry_redirect((SIGNAL_FUNC) settings_save_confirm, - format, 0, g_strdup(data)); - g_free(format); + cmd_params_free(free_arg); } static void settings_clean_confirm(const char *line) |