]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_regex_stdlib.cpp
Set the minimum length to 1 for most config items with a default.
[user/henk/code/inspircd.git] / src / modules / extra / m_regex_stdlib.cpp
index 7a888ed722b77b0523ec321a44372b71d76d03b8..80cf299f1cdb576b5e0d0cf61978b11956f30220 100644 (file)
@@ -1,7 +1,10 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2012 ChrisTX <chris@rev-crew.info>
+ *   Copyright (C) 2019 Robby <robby@chatbelgie.be>
+ *   Copyright (C) 2013, 2016, 2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2013 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -72,22 +75,22 @@ public:
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                ConfigTag* Conf = ServerInstance->Config->ConfValue("stdregex");
-               std::string regextype = Conf->getString("type", "ecmascript");
 
-               if(regextype == "bre")
+               const std::string regextype = Conf->getString("type", "ecmascript", 1);
+               if (stdalgo::string::equalsci(regextype, "bre"))
                        ref.regextype = std::regex::basic;
-               else if(regextype == "ere")
+               else if (stdalgo::string::equalsci(regextype, "ere"))
                        ref.regextype = std::regex::extended;
-               else if(regextype == "awk")
+               else if (stdalgo::string::equalsci(regextype, "awk"))
                        ref.regextype = std::regex::awk;
-               else if(regextype == "grep")
+               else if (stdalgo::string::equalsci(regextype, "grep"))
                        ref.regextype = std::regex::grep;
-               else if(regextype == "egrep")
+               else if (stdalgo::string::equalsci(regextype, "egrep"))
                        ref.regextype = std::regex::egrep;
                else
                {
-                       if(regextype != "ecmascript")
-                               ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Non-existent regex engine '%s' specified. Falling back to ECMAScript.", regextype.c_str());
+                       if (!stdalgo::string::equalsci(regextype, "ecmascript"))
+                               ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Nonexistent regex engine '%s' specified. Falling back to ECMAScript.", regextype.c_str());
                        ref.regextype = std::regex::ECMAScript;
                }
        }