diff options
| author | 2021-04-06 20:06:18 +0100 | |
|---|---|---|
| committer | 2021-04-07 10:36:11 +0100 | |
| commit | 942fd2bcfd384a12c900999fe663202c87319a68 (patch) | |
| tree | c2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_rmode.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
| download | inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.gz inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.bz2 inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.zip | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_rmode.cpp')
| -rw-r--r-- | src/modules/m_rmode.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp index 593a5ca36..d39119fba 100644 --- a/src/modules/m_rmode.cpp +++ b/src/modules/m_rmode.cpp @@ -68,22 +68,21 @@ class CommandRMode : public Command if ((pm = mh->IsPrefixMode())) { // As user prefix modes don't have a GetList() method, let's iterate through the channel's users. - const Channel::MemberMap& users = chan->GetUsers(); - for (Channel::MemberMap::const_iterator it = users.begin(); it != users.end(); ++it) + for (const auto& [u, memb] : chan->GetUsers()) { - if (!InspIRCd::Match(it->first->nick, pattern)) + if (!InspIRCd::Match(u->nick, pattern)) continue; - if (it->second->HasMode(pm) && !((it->first == user) && (pm->GetPrefixRank() > VOICE_VALUE))) - changelist.push_remove(mh, it->first->nick); + + if (memb->HasMode(pm) && !((u == user) && (pm->GetPrefixRank() > VOICE_VALUE))) + changelist.push_remove(mh, u->nick); } } else if ((lm = mh->IsListModeBase()) && ((ml = lm->GetList(chan)) != NULL)) { - for (ListModeBase::ModeList::iterator it = ml->begin(); it != ml->end(); ++it) + for (const auto& entry : *ml) { - if (!InspIRCd::Match(it->mask, pattern)) - continue; - changelist.push_remove(mh, it->mask); + if (InspIRCd::Match(entry.mask, pattern)) + changelist.push_remove(mh, entry.mask); } } else |
