# HG changeset patch # User David Demelier # Date 1479067185 -3600 # Node ID 56475d6c1c302954ee261a42f2883bb1c0e08856 # Parent 24b1709093e755418562c882ed09ca10b46c54c3 Irccd: fix util::isBoolean diff -r 24b1709093e7 -r 56475d6c1c30 libcommon/irccd/util.cpp --- a/libcommon/irccd/util.cpp Sun Nov 13 14:16:58 2016 +0100 +++ b/libcommon/irccd/util.cpp Sun Nov 13 20:59:45 2016 +0100 @@ -374,8 +374,12 @@ return MessagePair(result, ((iscommand) ? MessageType::Command : MessageType::Message)); } -bool isBoolean(const std::string &value) noexcept +bool isBoolean(std::string value) noexcept { + std::transform(value.begin(), value.end(), value.begin(), [] (auto c) { + return toupper(c); + }); + return value == "1" || value == "YES" || value == "TRUE" || value == "ON"; } diff -r 24b1709093e7 -r 56475d6c1c30 libcommon/irccd/util.hpp --- a/libcommon/irccd/util.hpp Sun Nov 13 14:16:58 2016 +0100 +++ b/libcommon/irccd/util.hpp Sun Nov 13 20:59:45 2016 +0100 @@ -253,7 +253,7 @@ * \return true if is boolean * \note this function is case-insensitive */ -IRCCD_EXPORT bool isBoolean(const std::string &value) noexcept; +IRCCD_EXPORT bool isBoolean(std::string value) noexcept; /** * Check if the string is an integer.