From 2d9a537c33aa21f14b87b3632e368947a494bc1c Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Sun, 15 Jan 2012 05:04:21 +0000 Subject: [PATCH] "no" should be false in CString::ToBool() --- src/ZNCString.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ZNCString.cpp b/src/ZNCString.cpp index 7b01f15e..96000f17 100644 --- a/src/ZNCString.cpp +++ b/src/ZNCString.cpp @@ -966,7 +966,14 @@ CString CString::ToTimeStr(unsigned long s) { return sRet.RightChomp_n(); } -bool CString::ToBool() const { return (!Trim_n().Trim_n("0").empty() && !Trim_n().Equals("false")); } +bool CString::ToBool() const { + CString sTrimmed = Trim_n(); + return (!sTrimmed.Trim_n("0").empty() && + !sTrimmed.Equals("false") && + !sTrimmed.Equals("no") && + !sTrimmed.Equals("n")); +} + short CString::ToShort() const { return strtoul(this->c_str(), (char**) NULL, 10); } unsigned short CString::ToUShort() const { return strtoul(this->c_str(), (char**) NULL, 10); } unsigned int CString::ToUInt() const { return strtoul(this->c_str(), (char**) NULL, 10); }