summaryrefslogtreecommitdiff
path: root/modules/pseudoclients/chanserv.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/pseudoclients/chanserv.cpp
parentdc371aad6d059dbf7f30f6878c680532bedd4146 (diff)
Start migrating to range-based for loops.
Diffstat (limited to 'modules/pseudoclients/chanserv.cpp')
-rw-r--r--modules/pseudoclients/chanserv.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp
index 9349ee6bc..ca7c7b9ab 100644
--- a/modules/pseudoclients/chanserv.cpp
+++ b/modules/pseudoclients/chanserv.cpp
@@ -146,10 +146,8 @@ class ChanServCore : public Module, public ChanServService
nc->GetChannelReferences(chans);
int max_reg = Config->GetModule(this)->Get<int>("maxregistered");
- for (unsigned i = 0; i < chans.size(); ++i)
+ for (auto *ci : chans)
{
- ChannelInfo *ci = chans[i];
-
if (ci->GetFounder() == nc)
{
NickCore *newowner = NULL;
@@ -220,9 +218,9 @@ class ChanServCore : public Module, public ChanServService
std::deque<Anope::string> chans;
ci->GetChannelReferences(chans);
- for (unsigned i = 0; i < chans.size(); ++i)
+ for (const auto &chan : chans)
{
- ChannelInfo *c = ChannelInfo::Find(chans[i]);
+ ChannelInfo *c = ChannelInfo::Find(chan);
if (!c)
continue;
@@ -303,8 +301,8 @@ class ChanServCore : public Module, public ChanServService
void OnCreateChan(ChannelInfo *ci) override
{
/* Set default chan flags */
- for (unsigned i = 0; i < defaults.size(); ++i)
- ci->Extend<bool>(defaults[i].upper());
+ for (const auto &def : defaults)
+ ci->Extend<bool>(def.upper());
}
EventReturn OnCanSet(User *u, const ChannelMode *cm) override
@@ -385,9 +383,8 @@ class ChanServCore : public Module, public ChanServService
ChannelMode *perm = ModeManager::FindChannelModeByName("PERM");
/* Find all persistent channels and create them, as we are about to finish burst to our uplink */
- for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
+ for (const auto &[_, ci] : *RegisteredChannelList)
{
- ChannelInfo *ci = it->second;
if (!persist->HasExt(ci))
continue;