Moved /SAVE and /RELOAD to fe-common. Print "config saved" and

"config reloaded" messages.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@510 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-22 22:05:29 +00:00 committed by cras
commit d9b661a1fb
6 changed files with 40 additions and 28 deletions

View file

@ -227,12 +227,36 @@ static void cmd_unalias(const char *data)
alias_remove(data);
}
static void cmd_reload(const char *data)
{
char *fname;
fname = *data != '\0' ? g_strdup(data) :
g_strdup_printf("%s/.irssi/config", g_get_home_dir());
if (settings_reread(fname)) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
IRCTXT_CONFIG_RELOADED, fname);
}
g_free(fname);
}
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);
}
}
void fe_settings_init(void)
{
command_bind("set", NULL, (SIGNAL_FUNC) cmd_set);
command_bind("toggle", NULL, (SIGNAL_FUNC) cmd_toggle);
command_bind("alias", NULL, (SIGNAL_FUNC) cmd_alias);
command_bind("unalias", NULL, (SIGNAL_FUNC) cmd_unalias);
command_bind("reload", NULL, (SIGNAL_FUNC) cmd_reload);
command_bind("save", NULL, (SIGNAL_FUNC) cmd_save);
command_set_options("set", "clear");
}
@ -243,4 +267,6 @@ void fe_settings_deinit(void)
command_unbind("toggle", (SIGNAL_FUNC) cmd_toggle);
command_unbind("alias", (SIGNAL_FUNC) cmd_alias);
command_unbind("unalias", (SIGNAL_FUNC) cmd_unalias);
command_unbind("reload", (SIGNAL_FUNC) cmd_reload);
command_unbind("save", (SIGNAL_FUNC) cmd_save);
}

View file

@ -121,6 +121,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "perl_error", "Perl error: $0", 1, { 0 } },
{ "bind_key", "$[10]0 $1 $2", 3, { 0, 0, 0 } },
{ "bind_unknown_id", "Unknown bind action: $0", 1, { 0 } },
{ "config_saved", "Saved configuration to file $0", 1, { 0 } },
{ "config_reloaded", "Reloaded configuration", 1, { 0 } },
{ NULL, NULL, 0 }
};

View file

@ -91,8 +91,9 @@ enum {
IRCTXT_NOT_TOGGLE,
IRCTXT_PERL_ERROR,
IRCTXT_BIND_KEY,
IRCTXT_BIND_UNKNOWN_ID
IRCTXT_BIND_UNKNOWN_ID,
IRCTXT_CONFIG_SAVED,
IRCTXT_CONFIG_RELOADED
};
extern FORMAT_REC fecommon_core_formats[];