mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Irssi won't automatically overwrite configuration files if they're
changed while irssi is running: - /SAVE asks whether to save it or not - autosave at quit saves it to config.autosave file git-svn-id: http://svn.irssi.org/repos/irssi/trunk@762 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
228c1d7f36
commit
a2cac63e56
5 changed files with 115 additions and 15 deletions
|
|
@ -245,14 +245,38 @@ static void cmd_reload(const char *data)
|
|||
g_free(fname);
|
||||
}
|
||||
|
||||
static void settings_save_fe(const char *fname)
|
||||
{
|
||||
if (settings_save(fname)) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_CONFIG_SAVED, fname);
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_save_confirm(const char *line, char *fname)
|
||||
{
|
||||
if (toupper(*line) == 'Y')
|
||||
settings_save_fe(fname);
|
||||
g_free(fname);
|
||||
}
|
||||
|
||||
/* SYNTAX: SAVE [<file>] */
|
||||
static void cmd_save(const char *data)
|
||||
{
|
||||
if (settings_save(*data != '\0' ? data : NULL)) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_CONFIG_SAVED, *data != '\0' ? data :
|
||||
mainconfig->fname);
|
||||
if (*data == '\0')
|
||||
data = mainconfig->fname;
|
||||
|
||||
if (!irssi_config_is_changed(data)) {
|
||||
settings_save_fe(data);
|
||||
return;
|
||||
}
|
||||
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_CONFIG_MODIFIED, data);
|
||||
signal_emit("gui entry redirect", 4,
|
||||
settings_save_confirm,
|
||||
_("Overwrite config (y/N)?"),
|
||||
GINT_TO_POINTER(FALSE), g_strdup(data));
|
||||
}
|
||||
|
||||
void fe_settings_init(void)
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ FORMAT_REC fecommon_core_formats[] = {
|
|||
{ "bind_unknown_id", "Unknown bind action: $0", 1, { 0 } },
|
||||
{ "config_saved", "Saved configuration to file $0", 1, { 0 } },
|
||||
{ "config_reloaded", "Reloaded configuration", 1, { 0 } },
|
||||
{ "config_modified", "Configuration file was modified since irssi was last started - do you want to overwrite the possible changes?", 1, { 0 } },
|
||||
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -167,7 +167,8 @@ enum {
|
|||
IRCTXT_BIND_KEY,
|
||||
IRCTXT_BIND_UNKNOWN_ID,
|
||||
IRCTXT_CONFIG_SAVED,
|
||||
IRCTXT_CONFIG_RELOADED
|
||||
IRCTXT_CONFIG_RELOADED,
|
||||
IRCTXT_CONFIG_MODIFIED
|
||||
};
|
||||
|
||||
extern FORMAT_REC fecommon_core_formats[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue