aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_callerid.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-04-06 20:06:18 +0100
committerGravatar Sadie Powell2021-04-07 10:36:11 +0100
commit942fd2bcfd384a12c900999fe663202c87319a68 (patch)
treec2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_callerid.cpp
parentMerge branch 'insp3' into master. (diff)
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_callerid.cpp')
-rw-r--r--src/modules/m_callerid.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 887c8b337..cea80ed1d 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -63,9 +63,8 @@ class callerid_data
{
std::ostringstream oss;
oss << lastnotify;
- for (UserSet::const_iterator i = accepting.begin(); i != accepting.end(); ++i)
+ for (const auto& u : accepting)
{
- User* u = *i;
if (human)
oss << ' ' << u->nick;
else
@@ -137,10 +136,9 @@ struct CallerIDExtInfo : public ExtensionItem
callerid_data* dat = static_cast<callerid_data*>(item);
// We need to walk the list of users on our accept list, and remove ourselves from their wholistsme.
- for (callerid_data::UserSet::iterator it = dat->accepting.begin(); it != dat->accepting.end(); ++it)
+ for (const auto& user : dat->accepting)
{
- callerid_data *targ = this->Get(*it, false);
-
+ callerid_data* targ = this->Get(user, false);
if (!targ)
{
ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (1)");
@@ -269,8 +267,8 @@ public:
callerid_data* dat = extInfo.Get(user, false);
if (dat)
{
- for (callerid_data::UserSet::iterator i = dat->accepting.begin(); i != dat->accepting.end(); ++i)
- user->WriteNumeric(RPL_ACCEPTLIST, (*i)->nick);
+ for (const auto& accepted : dat->accepting)
+ user->WriteNumeric(RPL_ACCEPTLIST, accepted->nick);
}
user->WriteNumeric(RPL_ENDOFACCEPT, "End of ACCEPT list");
}
@@ -376,10 +374,8 @@ class ModuleCallerID
return;
// Iterate over the list of people who accept me, and remove all entries
- for (callerid_data::CallerIdDataSet::iterator it = userdata->wholistsme.begin(); it != userdata->wholistsme.end(); ++it)
+ for (const auto& dat : userdata->wholistsme)
{
- callerid_data *dat = *(it);
-
// Find me on their callerid list
if (!dat->accepting.erase(who))
ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (5)");