diff options
author | Alexander Færøy <ahf@irssi.org> | 2010-10-02 21:52:35 +0000 |
---|---|---|
committer | ahf <ahf@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2010-10-02 21:52:35 +0000 |
commit | e959bd36d4611adfb5ca6d68ae989832648416d9 (patch) | |
tree | b6c6142bf366148fc79d8cb6037507d589cb53fd | |
parent | 5e55d5b974983fcbf55af817992cf0bd9ab67c69 (diff) | |
download | irssi-e959bd36d4611adfb5ca6d68ae989832648416d9.zip |
Strip the argument for boolean options. Patch by Svante Kvarnström. Fixes: #769
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5191 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/fe-common/core/fe-settings.c | 12 |
2 files changed, 10 insertions, 3 deletions
@@ -77,3 +77,4 @@ Other patches (grep for "patch" in ChangeLog) by: Lukas Mai Ismael Luceno Thomas Karpiniec + Svante Kvarnström diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index 508c4e17..59f136b2 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -66,14 +66,20 @@ static void set_print_pattern(const char *pattern) static void set_boolean(const char *key, const char *value) { - if (g_ascii_strcasecmp(value, "ON") == 0) + char *stripped_value; + stripped_value = g_strdup(value); + g_strstrip(stripped_value); + + if (g_ascii_strcasecmp(stripped_value, "ON") == 0) settings_set_bool(key, TRUE); - else if (g_ascii_strcasecmp(value, "OFF") == 0) + else if (g_ascii_strcasecmp(stripped_value, "OFF") == 0) settings_set_bool(key, FALSE); - else if (g_ascii_strcasecmp(value, "TOGGLE") == 0) + else if (g_ascii_strcasecmp(stripped_value, "TOGGLE") == 0) settings_set_bool(key, !settings_get_bool(key)); else printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_NOT_TOGGLE); + + g_free(stripped_value); } static void set_int(const char *key, const char *value) |