From 942fd2bcfd384a12c900999fe663202c87319a68 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 20:06:18 +0100 Subject: Switch simple iterator loops to use range-based for loops. --- src/modules/m_rmode.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/modules/m_rmode.cpp') 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 -- cgit v1.3.1-10-gc9f91