aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_cloaking.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-10-31 20:03:19 +0000
committerGravatar Sadie Powell2020-10-31 22:33:35 +0000
commit441bd151da733d32e194de6e4a1744ae273b83ee (patch)
tree74eb1ee2aef413185bf3906a17f1b2c27373e03a /src/modules/m_cloaking.cpp
parentFix reading the <sslprofile> config. (diff)
Add stdalgo::iterator_range and switch config tag reading to use it.
This allows us to use range-based for loops which were not possible with the previous config tag system.
Diffstat (limited to 'src/modules/m_cloaking.cpp')
-rw-r--r--src/modules/m_cloaking.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 60868b79f..f4f76a033 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -427,23 +427,23 @@ class ModuleCloaking : public Module
void ReadConfig(ConfigStatus& status) override
{
ConfigTagList tags = ServerInstance->Config->ConfTags("cloak");
- if (tags.first == tags.second)
+ if (tags.empty())
throw ModuleException("You have loaded the cloaking module but not configured any <cloak> tags!");
+ bool firstcloak = true;
std::vector<CloakInfo> newcloaks;
- for (ConfigIter i = tags.first; i != tags.second; ++i)
+ for (auto& [_, tag] : tags)
{
- ConfigTag* tag = i->second;
-
// Ensure that we have the <cloak:key> parameter.
const std::string key = tag->getString("key");
if (key.empty())
throw ModuleException("You have not defined a cloaking key. Define <cloak:key> as a " + ConvToStr(minkeylen) + "+ character network-wide secret, at " + tag->getTagLocation());
// If we are the first cloak method then mandate a strong key.
- if (i == tags.first && key.length() < minkeylen)
+ if (firstcloak && key.length() < minkeylen)
throw ModuleException("Your cloaking key is not secure. It should be at least " + ConvToStr(minkeylen) + " characters long, at " + tag->getTagLocation());
+ firstcloak = false;
const bool ignorecase = tag->getBool("ignorecase");
const std::string mode = tag->getString("mode");
const std::string prefix = tag->getString("prefix");