aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_dccallow.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-04-06 20:06:18 +0100
committerGravatar Sadie Powell2021-04-07 10:36:11 +0100
commit942fd2bcfd384a12c900999fe663202c87319a68 (patch)
treec2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_dccallow.cpp
parentMerge branch 'insp3' into master. (diff)
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_dccallow.cpp')
-rw-r--r--src/modules/m_dccallow.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 20e15bd71..14032a9a9 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -274,9 +274,9 @@ class CommandDccallow : public Command
return CmdResult::FAILURE;
}
- for (dccallowlist::const_iterator k = dl->begin(); k != dl->end(); ++k)
+ for (const auto& dccallow : *dl)
{
- if (k->nickname == target->nick)
+ if (dccallow.nickname == target->nick)
{
user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, InspIRCd::Format("%s is already on your DCCALLOW list", target->nick.c_str()));
return CmdResult::FAILURE;
@@ -358,9 +358,10 @@ class CommandDccallow : public Command
dl = ext.Get(user);
if (dl)
{
- for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c)
+ for (const auto& dccallow : *dl)
{
- user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, InspIRCd::Format("%s (%s)", c->nickname.c_str(), c->hostmask.c_str()));
+ user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, InspIRCd::Format("%s (%s)",
+ dccallow.nickname.c_str(), dccallow.hostmask.c_str()));
}
}
@@ -430,9 +431,11 @@ class ModuleDCCAllow : public Module
dl = ext.Get(u);
if (dl && dl->size())
{
- for (dccallowlist::const_iterator iter = dl->begin(); iter != dl->end(); ++iter)
- if (InspIRCd::Match(user->GetFullHost(), iter->hostmask))
+ for (const auto& dccallow : *dl)
+ {
+ if (InspIRCd::Match(user->GetFullHost(), dccallow.hostmask))
return MOD_RES_PASSTHRU;
+ }
}
size_t s = ctcpbody.find(' ');