1
0
mirror of https://github.com/irssi/irssi.git synced 2024-07-21 03:14:16 -04:00

Added formats to /SET texts.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1517 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-05-26 19:20:45 +00:00 committed by cras
parent 7038b7f1ab
commit 7cab17c2c9
3 changed files with 19 additions and 7 deletions

View File

@ -50,7 +50,8 @@ static void set_print(SETTINGS_REC *rec)
default:
value = "";
}
printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%s = %s", rec->key, value);
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_SET_ITEM,
rec->key, value);
}
static void set_boolean(const char *key, const char *value)
@ -92,7 +93,8 @@ static void cmd_set(char *data)
if (strcmp(last_section, rec->section) != 0) {
/* print section */
printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%_[ %s ]", rec->section);
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
TXT_SET_TITLE, rec->section);
last_section = rec->section;
}
@ -123,8 +125,10 @@ static void cmd_set(char *data)
}
g_slist_free(sets);
if (!found)
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown setting %s", key);
if (!found) {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_SET_UNKNOWN, key);
}
cmd_params_free(free_arg);
}
@ -143,9 +147,9 @@ static void cmd_toggle(const char *data)
type = settings_get_type(key);
if (type == -1)
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown setting %_%s", key);
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
else if (type != SETTING_TYPE_BOOLEAN)
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Setting %_%s%_ isn't boolean, use /SET", key);
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_NOT_BOOLEAN, key);
else {
set_boolean(key, *value != '\0' ? value : "TOGGLE");
set_print(settings_get_record(key));

View File

@ -223,6 +223,10 @@ FORMAT_REC fecommon_core_formats[] = {
{ "config_modified", "Configuration file was modified since irssi was last started - do you want to overwrite the possible changes?", 1, { 0 } },
{ "glib_error", "{error GLib $0} $1", 2, { 0, 0 } },
{ "overwrite_config", "Overwrite config (y/N)?", 0 },
{ "set_title", "[{hilight $0}]", 1, { 0 } },
{ "set_item", "$0 = $1", 2, { 0, 0 } },
{ "set_unknown", "Unknown setting $0", 1, { 0 } },
{ "set_not_boolean", "Setting {hilight $0} isn't boolean, use /SET", 1, { 0 } },
{ NULL, NULL, 0 }
};

View File

@ -188,7 +188,11 @@ enum {
TXT_CONFIG_RELOADED,
TXT_CONFIG_MODIFIED,
TXT_GLIB_ERROR,
TXT_OVERWRITE_CONFIG
TXT_OVERWRITE_CONFIG,
TXT_SET_TITLE,
TXT_SET_ITEM,
TXT_SET_UNKNOWN,
TXT_SET_NOT_BOOLEAN
};
extern FORMAT_REC fecommon_core_formats[];