summaryrefslogtreecommitdiff
path: root/modules/pseudoclients/nickserv.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/nickserv.cpp
parentdc371aad6d059dbf7f30f6878c680532bedd4146 (diff)
Start migrating to range-based for loops.
Diffstat (limited to 'modules/pseudoclients/nickserv.cpp')
-rw-r--r--modules/pseudoclients/nickserv.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index e17f8a5ba..4cdb3a238 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -147,8 +147,8 @@ class NickServCore : public Module, public NickServService
/* On shutdown, restart, or mod unload, remove all of our holds for nicks (svshold or qlines)
* because some IRCds do not allow us to have these automatically expire
*/
- for (nickalias_map::const_iterator it = NickAliasList->begin(); it != NickAliasList->end(); ++it)
- this->Release(it->second);
+ for (const auto &[_, na] : *NickAliasList)
+ this->Release(na);
}
void OnRestart() override
@@ -340,14 +340,14 @@ class NickServCore : public Module, public NickServService
Configuration::Block *block = Config->GetModule(this);
if (block->Get<bool>("modeonid", "yes"))
-
- for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it)
+ {
+ for (const auto &[_, cc] : u->chans)
{
- ChanUserContainer *cc = it->second;
Channel *c = cc->chan;
if (c)
c->SetCorrectModes(u, true);
}
+ }
const Anope::string &modesonid = block->Get<const Anope::string>("modesonid");
if (!modesonid.empty())
@@ -363,9 +363,8 @@ class NickServCore : public Module, public NickServService
"any third-party person."), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str());
}
- for (std::set<NickServCollide *>::iterator it = collides.begin(); it != collides.end(); ++it)
+ for (auto *c : collides)
{
- NickServCollide *c = *it;
if (c->GetUser() == u && c->GetNick() && c->GetNick()->nc == u->Account())
{
delete c;
@@ -382,9 +381,8 @@ class NickServCore : public Module, public NickServService
void OnNickUpdate(User *u) override
{
- for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it)
+ for (const auto &[_, cc] : u->chans)
{
- ChanUserContainer *cc = it->second;
Channel *c = cc->chan;
if (c)
c->SetCorrectModes(u, true);
@@ -414,10 +412,8 @@ class NickServCore : public Module, public NickServService
void OnServerSync(Server *s) override
{
- for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
+ for (const auto &[_, u] : UserListByNick)
{
- User *u = it->second;
-
if (u->server == s)
{
if (u->HasMode("REGISTERED") && !u->IsIdentified(true))
@@ -498,8 +494,8 @@ class NickServCore : public Module, public NickServService
void OnNickCoreCreate(NickCore *nc) override
{
/* Set default flags */
- for (unsigned i = 0; i < defaults.size(); ++i)
- nc->Extend<bool>(defaults[i].upper());
+ for (const auto &def : defaults)
+ nc->Extend<bool>(def.upper());
}
void OnUserQuit(User *u, const Anope::string &msg) override