diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-08-22 16:46:44 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-08-22 16:46:44 +0200 |
commit | 90ea1b01b78a94486b8142808c06aacff543ca64 (patch) | |
tree | 50d3582ff28f56a3816307cc6e10fc4f775d2e2a /src | |
parent | 0562561425f133874685789269c8ab1aa053c95f (diff) |
Add stdalgo::string::equalsci and use it instead of irc::string for case-insensitive comparison
Diffstat (limited to 'src')
-rw-r--r-- | src/configreader.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_dccallow.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_knock.cpp | 6 |
4 files changed, 12 insertions, 16 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 8a432e82f..0299b326a 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -433,11 +433,11 @@ void ServerConfig::Fill() throw CoreException(Network + " is not a valid network name. A network name must not contain spaces."); std::string defbind = options->getString("defaultbind"); - if (assign(defbind) == "ipv4") + if (stdalgo::string::equalsci(defbind, "ipv4")) { WildcardIPv6 = false; } - else if (assign(defbind) == "ipv6") + else if (stdalgo::string::equalsci(defbind, "ipv6")) { WildcardIPv6 = true; } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index d8fbef69a..edf9d012f 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -328,12 +328,12 @@ class ModuleDCCAllow : public Module if (s == std::string::npos) return MOD_RES_PASSTHRU; - irc::string type = assign(buf.substr(0, s)); + const std::string type = buf.substr(0, s); ConfigTag* conftag = ServerInstance->Config->ConfValue("dccallow"); bool blockchat = conftag->getBool("blockchat"); - if (type == "SEND") + if (stdalgo::string::equalsci(type, "SEND")) { size_t first; @@ -386,7 +386,7 @@ class ModuleDCCAllow : public Module u->WriteNotice("If you trust " + user->nick + " and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system."); return MOD_RES_DENY; } - else if ((type == "CHAT") && (blockchat)) + else if ((blockchat) && (stdalgo::string::equalsci(type, "CHAT"))) { user->WriteNotice("The user " + u->nick + " is not accepting DCC CHAT requests from you."); u->WriteNotice(user->nick + " (" + user->ident + "@" + user->dhost + ") attempted to initiate a DCC CHAT session, which was blocked."); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index a3e30ecb4..bd19a60ba 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -632,17 +632,15 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string &freeform bool ModuleFilter::StringToFilterAction(const std::string& str, FilterAction& fa) { - irc::string s(str.c_str()); - - if (s == "gline") + if (stdalgo::string::equalsci(str, "gline")) fa = FA_GLINE; - else if (s == "block") + else if (stdalgo::string::equalsci(str, "block")) fa = FA_BLOCK; - else if (s == "silent") + else if (stdalgo::string::equalsci(str, "silent")) fa = FA_SILENT; - else if (s == "kill") + else if (stdalgo::string::equalsci(str, "kill")) fa = FA_KILL; - else if (s == "none") + else if (stdalgo::string::equalsci(str, "none")) fa = FA_NONE; else return false; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index a6352749f..cf623c4ab 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -98,14 +98,12 @@ class ModuleKnock : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { std::string knocknotify = ServerInstance->Config->ConfValue("knock")->getString("notify"); - irc::string notify(knocknotify.c_str()); - - if (notify == "numeric") + if (stdalgo::string::equalsci(knocknotify, "numeric")) { cmd.sendnotice = false; cmd.sendnumeric = true; } - else if (notify == "both") + else if (stdalgo::string::equalsci(knocknotify, "both")) { cmd.sendnotice = true; cmd.sendnumeric = true; |