summaryrefslogtreecommitdiff
path: root/modules/cs_statusupdate.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2023-10-10 21:14:50 +0100
committerSadie Powell <sadie@witchery.services>2023-10-11 15:51:52 +0100
commita3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch)
tree82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /modules/cs_statusupdate.cpp
parentdc371aad6d059dbf7f30f6878c680532bedd4146 (diff)
Start migrating to range-based for loops.
Diffstat (limited to 'modules/cs_statusupdate.cpp')
-rw-r--r--modules/cs_statusupdate.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/cs_statusupdate.cpp b/modules/cs_statusupdate.cpp
index 3ae3890db..c871489fc 100644
--- a/modules/cs_statusupdate.cpp
+++ b/modules/cs_statusupdate.cpp
@@ -19,46 +19,48 @@ class StatusUpdate : public Module
void OnAccessAdd(ChannelInfo *ci, CommandSource &, ChanAccess *access) override
{
if (ci->c)
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ {
+ for (const auto &[_, uc] : ci->c->users)
{
- User *user = it->second->user;
+ User *user = uc->user;
ChannelInfo *next;
if (user->server != Me && access->Matches(user, user->Account(), next))
{
AccessGroup ag = ci->AccessFor(user);
- for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
+ for (auto *cms : ModeManager::GetStatusChannelModesByRank())
{
- ChannelModeStatus *cms = ModeManager::GetStatusChannelModesByRank()[i];
if (!ag.HasPriv("AUTO" + cms->name))
ci->c->RemoveMode(NULL, cms, user->GetUID());
}
ci->c->SetCorrectModes(user, true);
}
}
+ }
}
void OnAccessDel(ChannelInfo *ci, CommandSource &, ChanAccess *access) override
{
if (ci->c)
- for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
+ {
+ for (const auto &[_, uc] : ci->c->users)
{
- User *user = it->second->user;
+ User *user = uc->user;
ChannelInfo *next;
if (user->server != Me && access->Matches(user, user->Account(), next))
{
AccessGroup ag = ci->AccessFor(user);
- for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
+ for (auto *cms : ModeManager::GetStatusChannelModesByRank())
{
- ChannelModeStatus *cms = ModeManager::GetStatusChannelModesByRank()[i];
- if (!ag.HasPriv("AUTO" + cms->name))
+ if (!ag.HasPriv("AUTO" + cms->name))
ci->c->RemoveMode(NULL, cms, user->GetUID());
}
}
}
+ }
}
};