From c31e36169416b0bd429f0ddec0c8b07ce4cae054 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() --- ZNCString.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ZNCString.cpp b/ZNCString.cpp index a9d9eb24..12877cac 100644 --- a/ZNCString.cpp +++ b/ZNCString.cpp @@ -902,7 +902,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); }