summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@irssi.org>2010-10-02 21:52:35 +0000
committerahf <ahf@dbcabf3a-b0e7-0310-adc4-f8d773084564>2010-10-02 21:52:35 +0000
commite959bd36d4611adfb5ca6d68ae989832648416d9 (patch)
treeb6c6142bf366148fc79d8cb6037507d589cb53fd
parent5e55d5b974983fcbf55af817992cf0bd9ab67c69 (diff)
downloadirssi-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--AUTHORS1
-rw-r--r--src/fe-common/core/fe-settings.c12
2 files changed, 10 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 122a8fe8..50f24ac4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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)