1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 17:04:47 +02:00

Use auto in as many places as possible.

This commit is contained in:
Sadie Powell
2026-03-05 18:03:44 +00:00
parent 98703052cc
commit 12545ccbde
72 changed files with 198 additions and 198 deletions
+5 -5
View File
@@ -147,7 +147,7 @@ struct BadWordsImpl final
BadWordsImpl::~BadWordsImpl()
{
for (list::iterator it = badwords->begin(); it != badwords->end();)
for (auto it = badwords->begin(); it != badwords->end();)
{
auto *bw = *it;
++it;
@@ -160,10 +160,10 @@ BadWordImpl::~BadWordImpl()
ChannelInfo *ci = ChannelInfo::Find(chan);
if (ci)
{
BadWordsImpl *badwords = ci->GetExt<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
auto *badwords = ci->GetExt<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
if (badwords)
{
BadWordsImpl::list::iterator it = std::find(badwords->badwords->begin(), badwords->badwords->end(), this);
auto it = std::find(badwords->badwords->begin(), badwords->badwords->end(), this);
if (it != badwords->badwords->end())
badwords->badwords->erase(it);
}
@@ -193,7 +193,7 @@ Serializable *BadWordTypeImpl::Unserialize(Serializable *obj, Serialize::Data &d
bw->word = sword;
bw->type = StringToType(n);
BadWordsImpl *bws = ci->Require<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
auto *bws = ci->Require<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
if (!obj)
bws->badwords->push_back(bw);
@@ -337,7 +337,7 @@ private:
realword = word.substr(0, pos);
}
unsigned badwordsmax = Config->GetModule(this->module).Get<unsigned>("badwordsmax");
auto badwordsmax = Config->GetModule(this->module).Get<unsigned>("badwordsmax");
if (badwords->GetBadWordCount() >= badwordsmax)
{
source.Reply(_("You can only have %d bad words entries on a channel."), badwordsmax);
+5 -5
View File
@@ -51,7 +51,7 @@ struct KickerDataImpl final
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
return;
const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(e);
const auto *ci = anope_dynamic_static_cast<const ChannelInfo *>(e);
auto *kd = this->Get(ci);
if (kd == NULL)
return;
@@ -85,7 +85,7 @@ struct KickerDataImpl final
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
return;
ChannelInfo *ci = anope_dynamic_static_cast<ChannelInfo *>(e);
auto *ci = anope_dynamic_static_cast<ChannelInfo *>(e);
auto *kd = ci->Require<BotServ::KickerData>(BOTSERV_KICKER_DATA_EXT);
data["kickerdata:amsgs"] >> kd->amsgs;
@@ -988,7 +988,7 @@ public:
void purge()
{
time_t keepdata = Config->GetModule(me).Get<time_t>("keepdata");
for (data_type::iterator it = data_map.begin(), it_end = data_map.end(); it != it_end;)
for (auto it = data_map.begin(), it_end = data_map.end(); it != it_end;)
{
const Anope::string &user = it->first;
Data &bd = it->second;
@@ -1038,7 +1038,7 @@ public:
for (auto &[_, c] : ChannelList)
{
BanData *bd = c->GetExt<BanData>("bandata");
auto *bd = c->GetExt<BanData>("bandata");
if (bd != NULL)
{
bd->purge();
@@ -1488,7 +1488,7 @@ public:
if (ud->lastline.equals_ci(realbuf) && !ud->lasttarget.empty() && !ud->lasttarget.equals_ci(ci->name))
{
for (User::ChanUserList::iterator it = u->chans.begin(); it != u->chans.end();)
for (auto it = u->chans.begin(); it != u->chans.end();)
{
Channel *chan = it->second->chan;
++it;
+2 -2
View File
@@ -357,7 +357,7 @@ public:
if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly)
return;
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; )
for (auto it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; )
{
ChannelInfo *ci = it->second;
++it;
@@ -369,7 +369,7 @@ public:
if (ci->c)
{
time_t last_used = ci->last_used;
for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end && last_used == ci->last_used; ++cit)
for (auto cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end && last_used == ci->last_used; ++cit)
ci->AccessFor(cit->second->user);
expire = last_used == ci->last_used;
}
+2 -2
View File
@@ -276,7 +276,7 @@ private:
ServiceReference<AccessProvider> provider("AccessProvider", "access/access");
if (!provider)
return;
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
auto *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
access->SetMask(mask, ci);
access->creator = source.GetNick();
access->level = level;
@@ -960,7 +960,7 @@ public:
/* Access accessprovider is the only accessprovider with the concept of negative access,
* so check they don't have negative access
*/
const AccessChanAccess *aca = anope_dynamic_static_cast<const AccessChanAccess *>(highest);
const auto *aca = anope_dynamic_static_cast<const AccessChanAccess *>(highest);
if (aca->level < 0)
return EVENT_CONTINUE;
+2 -2
View File
@@ -201,7 +201,7 @@ class CommandCSAKick final
return;
}
for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; )
for (auto it = c->users.begin(), it_end = c->users.end(); it != it_end; )
{
auto *memb = it->second;
++it;
@@ -223,7 +223,7 @@ class CommandCSAKick final
const NickAlias *na = NickAlias::Find(mask);
NickCore *nc = NULL;
const ChanServ::AutoKick *akick;
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
auto reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
+2 -2
View File
@@ -128,7 +128,7 @@ public:
reason += " " + params[3];
}
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
auto reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
@@ -211,7 +211,7 @@ public:
}
int matched = 0, kicked = 0;
for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;)
for (auto it = c->users.begin(), it_end = c->users.end(); it != it_end;)
{
auto *memb = it->second;
++it;
+1 -1
View File
@@ -28,7 +28,7 @@ class CommandCSClone final
static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
{
std::set<Anope::string> masks;
unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
auto access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
unsigned count = 0;
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
+1 -1
View File
@@ -177,7 +177,7 @@ private:
std::vector<User *> users;
/* The newer users are at the end of the list, so kick users starting from the end */
for (Channel::ChanUserList::reverse_iterator it = ci->c->users.rbegin(), it_end = ci->c->users.rend(); it != it_end; ++it)
for (auto it = ci->c->users.rbegin(), it_end = ci->c->users.rend(); it != it_end; ++it)
{
auto *memb = it->second;
User *user = memb->user;
+1 -1
View File
@@ -98,7 +98,7 @@ Serializable *EntryMsgTypeImpl::Unserialize(Serializable *obj, Serialize::Data &
if (obj)
{
EntryMsgImpl *msg = anope_dynamic_static_cast<EntryMsgImpl *>(obj);
auto *msg = anope_dynamic_static_cast<EntryMsgImpl *>(obj);
msg->chan = ci->name;
data["creator"] >> msg->creator;
data["message"] >> msg->message;
+2 -2
View File
@@ -28,7 +28,7 @@ public:
bool HasPriv(const Anope::string &priv) const override
{
std::map<Anope::string, char>::iterator it = defaultFlags.find(priv);
auto it = defaultFlags.find(priv);
return it != defaultFlags.end() && this->flags.count(it->second) > 0;
}
@@ -301,7 +301,7 @@ class CommandCSFlags final
ServiceReference<AccessProvider> provider("AccessProvider", "access/flags");
if (!provider)
return;
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
auto *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
access->SetMask(mask, ci);
access->creator = source.GetNick();
access->description = current ? current->description : description;
+2 -2
View File
@@ -47,7 +47,7 @@ public:
return;
}
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
auto reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
@@ -90,7 +90,7 @@ public:
Log(LOG_COMMAND, source, this, ci) << "for " << mask;
int matched = 0, kicked = 0;
for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;)
for (auto it = c->users.begin(), it_end = c->users.end(); it != it_end;)
{
auto *memb = it->second;
++it;
+1 -1
View File
@@ -73,7 +73,7 @@ public:
}
Anope::string spattern = "#" + pattern;
unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
auto listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str());
+2 -2
View File
@@ -601,7 +601,7 @@ class CommandCSMode final
}
}
for (Channel::ChanUserList::const_iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end;)
for (auto it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end;)
{
auto *memb = it->second;
++it;
@@ -1102,7 +1102,7 @@ public:
Anope::string param;
if (cm->type == MODE_PARAM)
{
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
auto *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
if (add || !cmp->minus_no_arg)
{
sep.GetToken(param);
+1 -1
View File
@@ -28,7 +28,7 @@ public:
{
const Anope::string &chan = params[0];
const Anope::string &chdesc = params.size() > 1 ? params[1] : "";
unsigned maxregistered = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
auto maxregistered = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
User *u = source.GetUser();
NickCore *nc = source.nc;
+5 -5
View File
@@ -41,7 +41,7 @@ struct SeenInfo final
~SeenInfo() override
{
database_map::iterator iter = database.find(nick);
auto iter = database.find(nick);
if (iter != database.end() && iter->second == this)
database.erase(iter);
}
@@ -144,7 +144,7 @@ struct SeenInfoType final
static SeenInfo *FindInfo(const Anope::string &nick)
{
database_map::iterator iter = database.find(nick);
auto iter = database.find(nick);
if (iter != database.end())
return iter->second;
return NULL;
@@ -203,7 +203,7 @@ public:
time = Anope::CurTime - time;
database_map::iterator buf;
size_t counter = 0;
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
for (auto it = database.begin(), it_end = database.end(); it != it_end;)
{
buf = it;
++it;
@@ -379,9 +379,9 @@ public:
return;
auto previous_size = database.size();
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
for (auto it = database.begin(), it_end = database.end(); it != it_end;)
{
database_map::iterator cur = it;
auto cur = it;
++it;
if ((Anope::CurTime - cur->second->last) > purgetime)
+4 -4
View File
@@ -320,7 +320,7 @@ public:
}
NickCore *nc = na->nc;
unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
auto max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit"))
{
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
@@ -1018,7 +1018,7 @@ public:
"channel will be dropped."
));
unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
auto max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
if (max_reg)
{
source.Reply(" ");
@@ -1112,7 +1112,7 @@ class CSSet final
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
return;
const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(s);
const auto *ci = anope_dynamic_static_cast<const ChannelInfo *>(s);
Anope::string modes;
for (const auto &[last_mode, last_data] : ci->last_modes)
{
@@ -1138,7 +1138,7 @@ class CSSet final
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
return;
ChannelInfo *ci = anope_dynamic_static_cast<ChannelInfo *>(s);
auto *ci = anope_dynamic_static_cast<ChannelInfo *>(s);
Anope::string modes;
data["last_modes"] >> modes;
ci->last_modes.clear();
+3 -3
View File
@@ -116,7 +116,7 @@ public:
for (auto idx = reason_idx; idx < params.size(); ++idx)
reason.append(reason.empty() ? "" : " ").append(params[idx]);
CSSuspendInfo *si = ci->Extend<CSSuspendInfo>("CS_SUSPENDED");
auto *si = ci->Extend<CSSuspendInfo>("CS_SUSPENDED");
si->what = ci->name;
si->by = source.GetNick();
si->reason = reason;
@@ -186,7 +186,7 @@ public:
}
/* Only UNSUSPEND already suspended channels */
CSSuspendInfo *si = ci->GetExt<CSSuspendInfo>("CS_SUSPENDED");
auto *si = ci->GetExt<CSSuspendInfo>("CS_SUSPENDED");
if (!si)
{
source.Reply(_("Channel \002%s\002 isn't suspended."), ci->name.c_str());
@@ -254,7 +254,7 @@ public:
void OnReload(Configuration::Conf &conf) override
{
Anope::string s = conf.GetModule(this).Get<Anope::string>("show");
auto s = conf.GetModule(this).Get<Anope::string>("show");
commasepstream(s).GetTokens(show);
std::transform(show.begin(), show.end(), show.begin(), trim());
}
+2 -2
View File
@@ -58,7 +58,7 @@ public:
{
if (!source.GetUser())
return;
for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
for (auto it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
{
Channel *c = it->second->chan;
SetModes(source.GetUser(), c);
@@ -162,7 +162,7 @@ public:
{
if (!source.GetUser())
return;
for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
for (auto it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
{
Channel *c = it->second->chan;
RemoveAll(source.GetUser(), c);
+5 -5
View File
@@ -32,7 +32,7 @@ public:
bool HasPriv(const Anope::string &priv) const override
{
for (std::vector<Anope::string>::iterator it = std::find(order.begin(), order.end(), this->type); it != order.end(); ++it)
for (auto it = std::find(order.begin(), order.end(), this->type); it != order.end(); ++it)
{
const std::vector<Anope::string> &privs = permissions[*it];
if (std::find(privs.begin(), privs.end(), priv) != privs.end())
@@ -55,7 +55,7 @@ public:
{
if (access->provider->name == "access/xop")
{
const XOPChanAccess *xaccess = anope_dynamic_static_cast<const XOPChanAccess *>(access);
const auto *xaccess = anope_dynamic_static_cast<const XOPChanAccess *>(access);
return xaccess->type;
}
else
@@ -128,7 +128,7 @@ private:
bool override = false;
const NickAlias *na = NULL;
std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
auto cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccess::DetermineLevel(highest)) : order.end();
if (!access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
@@ -252,7 +252,7 @@ private:
ServiceReference<AccessProvider> provider("AccessProvider", "access/xop");
if (!provider)
return;
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
auto *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
acc->SetMask(mask, ci);
acc->creator = source.GetNick();
acc->description = description;
@@ -311,7 +311,7 @@ private:
}
}
std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
auto cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccess::DetermineLevel(highest)) : order.end();
if (!mask.equals_ci(nc->display) && !access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
+4 -4
View File
@@ -235,7 +235,7 @@ class MChanstats final
for (int i = 0; i < r.Rows(); ++i)
{
const std::map<Anope::string, Anope::string> &map = r.Row(i);
for (std::map<Anope::string, Anope::string>::const_iterator it = map.begin(); it != map.end(); ++it)
for (auto it = map.begin(); it != map.end(); ++it)
TableList.push_back(it->second);
}
query = "SHOW PROCEDURE STATUS WHERE `Db` = Database();";
@@ -254,7 +254,7 @@ class MChanstats final
bool HasTable(const Anope::string &table)
{
for (std::vector<Anope::string>::const_iterator it = TableList.begin(); it != TableList.end(); ++it)
for (auto it = TableList.begin(); it != TableList.end(); ++it)
if (*it == table)
return true;
return false;
@@ -262,7 +262,7 @@ class MChanstats final
bool HasProcedure(const Anope::string &table)
{
for (std::vector<Anope::string>::const_iterator it = ProcedureList.begin(); it != ProcedureList.end(); ++it)
for (auto it = ProcedureList.begin(); it != ProcedureList.end(); ++it)
if (*it == table)
return true;
return false;
@@ -270,7 +270,7 @@ class MChanstats final
bool HasEvent(const Anope::string &table)
{
for (std::vector<Anope::string>::const_iterator it = EventList.begin(); it != EventList.end(); ++it)
for (auto it = EventList.begin(); it != EventList.end(); ++it)
if (*it == table)
return true;
return false;
+7 -7
View File
@@ -729,7 +729,7 @@ public:
delete udpsock;
delete tcpsock;
for (std::map<unsigned short, Request *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end;)
for (auto it = this->requests.begin(), it_end = this->requests.end(); it != it_end;)
{
Request *request = it->second;
++it;
@@ -909,7 +909,7 @@ public:
return true;
}
std::map<unsigned short, Request *>::iterator it = this->requests.find(recv_packet.id);
auto it = this->requests.find(recv_packet.id);
if (it == this->requests.end())
{
Log(LOG_DEBUG_2) << "Resolver: Received an answer for something we didn't request";
@@ -1043,7 +1043,7 @@ private:
*/
bool CheckCache(Request *request)
{
cache_map::iterator it = this->cache.find(*request);
auto it = this->cache.find(*request);
if (it != this->cache.end())
{
Query &record = it->second;
@@ -1070,7 +1070,7 @@ public:
~ModuleDNS() override
{
for (std::map<int, Socket *>::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;)
for (auto it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;)
{
Socket *s = it->second;
++it;
@@ -1096,8 +1096,8 @@ public:
for (int i = 0; i < block.CountBlock("notify"); ++i)
{
const auto &n = block.GetBlock("notify", i);
Anope::string nip = n.Get<Anope::string>("ip");
short nport = n.Get<short>("port");
auto nip = n.Get<Anope::string>("ip");
auto nport = n.Get<short>("port");
notify.emplace_back(nip, nport);
}
@@ -1149,7 +1149,7 @@ public:
void OnModuleUnload(User *u, Module *m) override
{
for (std::map<unsigned short, Request *>::iterator it = this->manager.requests.begin(), it_end = this->manager.requests.end(); it != it_end;)
for (auto it = this->manager.requests.begin(), it_end = this->manager.requests.end(); it != it_end;)
{
unsigned short id = it->first;
Request *req = it->second;
+1 -1
View File
@@ -147,7 +147,7 @@ public:
if (params.empty())
return;
CommandInfo::map::const_iterator it = Config->Fantasy.end();
auto it = Config->Fantasy.end();
unsigned count = 0;
for (unsigned max = params.size(); it == Config->Fantasy.end() && max > 0; --max)
{
+1 -1
View File
@@ -138,7 +138,7 @@ public:
full_command += " " + params[i];
full_command.erase(full_command.begin());
CommandInfo::map::const_iterator it = map.find(full_command);
auto it = map.find(full_command);
if (it == map.end())
continue;
+2 -2
View File
@@ -354,7 +354,7 @@ public:
~HTTPD() override
{
for (std::map<int, Socket *>::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;)
for (auto it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;)
{
Socket *s = it->second;
++it;
@@ -447,7 +447,7 @@ public:
spacesepstream(ext_header).GetTokens(p->ext_headers);
}
for (std::map<Anope::string, MyHTTPProvider *>::iterator it = this->providers.begin(), it_end = this->providers.end(); it != it_end;)
for (auto it = this->providers.begin(), it_end = this->providers.end(); it != it_end;)
{
HTTP::Provider *p = it->second;
++it;
+3 -3
View File
@@ -115,7 +115,7 @@ public:
, nick(na->nick)
{
/* Erase the current release timer and use the new one */
Anope::map<NickServRelease *>::iterator nit = NickServReleases.find(this->nick);
auto nit = NickServReleases.find(this->nick);
if (nit != NickServReleases.end())
{
IRCD->SendQuit(nit->second);
@@ -379,7 +379,7 @@ public:
Log(NickServ, "nick") << "Deleting account " << nc->display;
/* Clean up this nick core from any users online */
for (std::list<User *>::iterator it = nc->users.begin(); it != nc->users.end();)
for (auto it = nc->users.begin(); it != nc->users.end();)
{
User *user = *it++;
IRCD->SendLogout(user);
@@ -610,7 +610,7 @@ public:
time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y");
for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; )
for (auto it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; )
{
NickAlias *na = it->second;
++it;
+7 -7
View File
@@ -34,10 +34,10 @@ struct AJoinEntry final
~AJoinEntry() override
{
AJoinList *channels = owner->GetExt<AJoinList>("ajoinlist");
auto *channels = owner->GetExt<AJoinList>("ajoinlist");
if (channels)
{
std::vector<AJoinEntry *>::iterator it = std::find((*channels)->begin(), (*channels)->end(), this);
auto it = std::find((*channels)->begin(), (*channels)->end(), this);
if (it != (*channels)->end())
(*channels)->erase(it);
}
@@ -89,7 +89,7 @@ struct AJoinEntryType final
if (!obj)
{
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
auto *channels = nc->Require<AJoinList>("ajoinlist");
(*channels)->push_back(aj);
}
@@ -108,7 +108,7 @@ class CommandNSAJoin final
{
static void DoList(CommandSource &source, NickCore *nc)
{
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
auto *channels = nc->Require<AJoinList>("ajoinlist");
if ((*channels)->empty())
source.Reply(_("%s's auto join list is empty."), nc->display.c_str());
@@ -141,7 +141,7 @@ class CommandNSAJoin final
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &chans, const Anope::string &keys)
{
const auto ajoinmax = Config->GetModule(this->owner).Get<unsigned>("ajoinmax");
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
auto *channels = nc->Require<AJoinList>("ajoinlist");
Anope::string addedchans;
Anope::string alreadyadded;
@@ -208,7 +208,7 @@ class CommandNSAJoin final
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &chans)
{
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
auto *channels = nc->Require<AJoinList>("ajoinlist");
Anope::string delchans;
Anope::string notfoundchans;
commasepstream sep(chans);
@@ -344,7 +344,7 @@ public:
if (!NickServ)
return;
AJoinList *channels = u->Account()->GetExt<AJoinList>("ajoinlist");
auto *channels = u->Account()->GetExt<AJoinList>("ajoinlist");
if (channels == NULL)
return;
+2 -2
View File
@@ -146,7 +146,7 @@ public:
NickAlias *target, *na = NickAlias::Find(source.GetNick());
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
unsigned maxaliases = Config->GetModule(this->owner).Get<unsigned>("maxaliases");
auto maxaliases = Config->GetModule(this->owner).Get<unsigned>("maxaliases");
if (!(target = NickAlias::Find(nick)))
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else if (user && Anope::CurTime < user->lastnickreg + reg_delay)
@@ -258,7 +258,7 @@ public:
{
NickCore *oldcore = na->nc;
std::vector<NickAlias *>::iterator it = std::find(oldcore->aliases->begin(), oldcore->aliases->end(), na);
auto it = std::find(oldcore->aliases->begin(), oldcore->aliases->end(), na);
if (it != oldcore->aliases->end())
oldcore->aliases->erase(it);
+1 -1
View File
@@ -91,7 +91,7 @@ public:
return;
}
unsigned int maxlogins = Config->GetModule(this->owner).Get<unsigned int>("maxlogins");
auto maxlogins = Config->GetModule(this->owner).Get<unsigned int>("maxlogins");
if (na && maxlogins && na->nc->users.size() >= maxlogins)
{
source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
+4 -4
View File
@@ -73,7 +73,7 @@ public:
{
if (!u->chans.empty())
{
NSRecoverInfo *ei = source.GetUser()->Extend<NSRecoverInfo>("recover");
auto *ei = source.GetUser()->Extend<NSRecoverInfo>("recover");
for (auto &[chan, cuc] : u->chans)
(*ei)[chan->name] = cuc->status;
}
@@ -108,7 +108,7 @@ public:
if (IRCD->CanSVSNick)
{
NSRecoverSvsnick *svs = u->Extend<NSRecoverSvsnick>("svsnick");
auto *svs = u->Extend<NSRecoverSvsnick>("svsnick");
svs->from = source.GetUser();
svs->to = u->nick;
}
@@ -253,7 +253,7 @@ public:
BotInfo *NickServ = Config->GetClient("NickServ");
if (ei != NULL && NickServ != NULL)
for (NSRecoverInfo::iterator it = ei->begin(), it_end = ei->end(); it != it_end;)
for (auto it = ei->begin(), it_end = ei->end(); it != it_end;)
{
Channel *c = Channel::Find(it->first);
const Anope::string &cname = it->first;
@@ -288,7 +288,7 @@ public:
if (ei != NULL)
{
NSRecoverInfo::iterator it = ei->find(c->name);
auto it = ei->find(c->name);
if (it != ei->end())
{
for (auto mode : it->second.Modes())
+1 -1
View File
@@ -181,7 +181,7 @@ public:
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
auto minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_(
+1 -1
View File
@@ -115,7 +115,7 @@ public:
Anope::string GetAgent()
{
Anope::string agent = Config->GetModule(Service::owner).Get<Anope::string>("agent", "NickServ");
auto agent = Config->GetModule(Service::owner).Get<Anope::string>("agent", "NickServ");
BotInfo *bi = Config->GetClient(agent);
if (bi)
agent = bi->GetUID();
+1 -1
View File
@@ -44,7 +44,7 @@ public:
bool ProcessMessage(SASL::Session *sess, const SASL::Message &m) override
{
Session *mysess = anope_dynamic_static_cast<Session *>(sess);
auto *mysess = anope_dynamic_static_cast<Session *>(sess);
if (m.type == "S")
{
+2 -2
View File
@@ -129,7 +129,7 @@ private:
if (s->GetSerializableType()->GetName() != NICKCORE_TYPE)
return;
const NickCore *nc = anope_dynamic_static_cast<const NickCore *>(s);
const auto *nc = anope_dynamic_static_cast<const NickCore *>(s);
Anope::string modes;
for (const auto &[last_mode, last_data] : nc->last_modes)
{
@@ -155,7 +155,7 @@ private:
if (s->GetSerializableType()->GetName() != NICKCORE_TYPE)
return;
NickCore *nc = anope_dynamic_static_cast<NickCore *>(s);
auto *nc = anope_dynamic_static_cast<NickCore *>(s);
Anope::string modes;
data["last_modes"] >> modes;
nc->last_modes.clear();
+3 -3
View File
@@ -124,7 +124,7 @@ public:
for (auto idx = reason_idx; idx < params.size(); ++idx)
reason.append(reason.empty() ? "" : " ").append(params[idx]);
NSSuspendInfo *si = nc->Extend<NSSuspendInfo>("NS_SUSPENDED");
auto *si = nc->Extend<NSSuspendInfo>("NS_SUSPENDED");
si->what = nc->display;
si->by = source.GetNick();
si->reason = reason;
@@ -199,7 +199,7 @@ public:
return;
}
NSSuspendInfo *si = na->nc->GetExt<NSSuspendInfo>("NS_SUSPENDED");
auto *si = na->nc->GetExt<NSSuspendInfo>("NS_SUSPENDED");
Log(LOG_ADMIN, source, this) << "for " << na->nick << " which was suspended by " << (!si->by.empty() ? si->by : "(none)") << " for: " << (!si->reason.empty() ? si->reason : "No reason");
@@ -258,7 +258,7 @@ public:
void OnReload(Configuration::Conf &conf) override
{
Anope::string s = conf.GetModule(this).Get<Anope::string>("show");
auto s = conf.GetModule(this).Get<Anope::string>("show");
commasepstream(s).GetTokens(show);
std::transform(show.begin(), show.end(), show.begin(), trim());
}
+1 -1
View File
@@ -86,7 +86,7 @@ struct DefconConfig final
bool GetDefConParam(const Anope::string &name, Anope::string &buf)
{
std::map<Anope::string, Anope::string>::iterator it = DefConModesOnParams.find(name);
auto it = DefConModesOnParams.find(name);
buf.clear();
+2 -2
View File
@@ -38,7 +38,7 @@ struct DNSZone final
~DNSZone() override
{
std::vector<DNSZone *>::iterator it = std::find(zones->begin(), zones->end(), this);
auto it = std::find(zones->begin(), zones->end(), this);
if (it != zones->end())
zones->erase(it);
}
@@ -127,7 +127,7 @@ public:
~DNSServer() override
{
std::vector<DNSServer *>::iterator it = std::find(dns_servers->begin(), dns_servers->end(), this);
auto it = std::find(dns_servers->begin(), dns_servers->end(), this);
if (it != dns_servers->end())
dns_servers->erase(it);
}
+4 -4
View File
@@ -325,7 +325,7 @@ public:
for (const auto &[_, user] : UserListByNick)
module->OnUserNickChange(user, "");
for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end;)
for (auto it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end;)
{
NickAlias *na = it->second;
++it;
@@ -346,7 +346,7 @@ public:
{
int chan_matches = 0, ci_matches = 0;
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;)
for (auto it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;)
{
Channel *c = it->second;
++it;
@@ -369,7 +369,7 @@ public:
++chan_matches;
for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end;)
for (auto cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end;)
{
User *u = cit->first;
++cit;
@@ -383,7 +383,7 @@ public:
}
}
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(); it != RegisteredChannelList->end();)
for (auto it = RegisteredChannelList->begin(); it != RegisteredChannelList->end();)
{
ChannelInfo *ci = it->second;
++it;
+6 -6
View File
@@ -77,10 +77,10 @@ OperInfoImpl::~OperInfoImpl()
Extensible *e = OperInfos::Find(target);
if (e)
{
OperInfos *op = e->GetExt<OperInfos>("operinfo");
auto *op = e->GetExt<OperInfos>("operinfo");
if (op)
{
std::vector<OperInfo *>::iterator it = std::find((*op)->begin(), (*op)->end(), this);
auto it = std::find((*op)->begin(), (*op)->end(), this);
if (it != (*op)->end())
(*op)->erase(it);
}
@@ -96,7 +96,7 @@ Serializable *OperInfoTypeImpl::Unserialize(Serializable *obj, Serialize::Data &
if (!e)
return NULL;
OperInfos *oi = e->Require<OperInfos>("operinfo");
auto *oi = e->Require<OperInfos>("operinfo");
OperInfoImpl *o;
if (obj)
o = anope_dynamic_static_cast<OperInfoImpl *>(obj);
@@ -162,7 +162,7 @@ public:
return;
}
OperInfos *oi = e->Require<OperInfos>("operinfo");
auto *oi = e->Require<OperInfos>("operinfo");
if ((*oi)->size() >= Config->GetModule(this->module).Get<unsigned>("max", "10"))
{
@@ -195,7 +195,7 @@ public:
return;
}
OperInfos *oi = e->GetExt<OperInfos>("operinfo");
auto *oi = e->GetExt<OperInfos>("operinfo");
if (!oi)
{
@@ -234,7 +234,7 @@ public:
}
else if (cmd.equals_ci("CLEAR"))
{
OperInfos *oi = e->GetExt<OperInfos>("operinfo");
auto *oi = e->GetExt<OperInfos>("operinfo");
if (!oi)
{
+1 -1
View File
@@ -202,7 +202,7 @@ public:
source.Reply(_("Users list:"));
for (Anope::map<User *>::const_iterator it = ordered_map.begin(); it != ordered_map.end(); ++it)
for (auto it = ordered_map.begin(); it != ordered_map.end(); ++it)
{
User *u2 = it->second;
+1 -1
View File
@@ -265,7 +265,7 @@ protected:
source.Reply(READ_ONLY_MODE);
if (!text.equals_ci("ALL"))
{
unsigned num = Anope::Convert<unsigned>(text, 0);
auto num = Anope::Convert<unsigned>(text, 0);
if (num > 0 && num <= list.size())
{
OperServ::news_service->DelNewsItem(list[num - 1]);
+2 -2
View File
@@ -205,7 +205,7 @@ public:
ListLimits *limits = maxlist.Get(c);
if (limits)
{
ListLimits::const_iterator limit = limits->find(cm->mchar);
auto limit = limits->find(cm->mchar);
if (limit != limits->end())
return limit->second;
}
@@ -2416,7 +2416,7 @@ struct IRCDMessageUID final
NickAlias *na = NULL;
if (SASL::service)
for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();)
for (auto it = saslusers.begin(); it != saslusers.end();)
{
SASLUser &u = *it;
+2 -2
View File
@@ -640,7 +640,7 @@ namespace UnrealExtBan
bool Matches(User *u, const Entry *e) override
{
ModData *moddata = u->GetExt<ModData>("ClientModData");
auto *moddata = u->GetExt<ModData>("ClientModData");
return moddata != NULL && moddata->find("operclass") != moddata->end() && Anope::Match((*moddata)["operclass"], e->GetMask());
}
};
@@ -674,7 +674,7 @@ namespace UnrealExtBan
bool Matches(User *u, const Entry *e) override
{
ModData *moddata = u->GetExt<ModData>("ClientModData");
auto *moddata = u->GetExt<ModData>("ClientModData");
if (moddata == NULL || moddata->find("geoip") == moddata->end())
return false;
+4 -4
View File
@@ -224,7 +224,7 @@ class ModuleProxyScan final
void Tick() override
{
for (std::set<ProxyConnect *>::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;)
for (auto it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;)
{
ProxyConnect *p = *it;
++it;
@@ -246,19 +246,19 @@ public:
~ModuleProxyScan() override
{
for (std::set<ProxyConnect *>::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;)
for (auto it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;)
{
ProxyConnect *p = *it;
++it;
delete p;
}
for (std::map<int, Socket *>::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;)
for (auto it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;)
{
Socket *s = it->second;
++it;
ClientSocket *cs = dynamic_cast<ClientSocket *>(s);
auto *cs = dynamic_cast<ClientSocket *>(s);
if (cs != NULL && cs->ls == this->listener)
delete s;
}
+3 -3
View File
@@ -473,7 +473,7 @@ bool RedisSocket::Read(const char *buffer, size_t l)
* __keyevent@0__:set
* key
*/
std::map<Anope::string, Interface *>::iterator it = this->subinterfaces.find(r.multi_bulk[1]->bulk);
auto it = this->subinterfaces.find(r.multi_bulk[1]->bulk);
if (it != this->subinterfaces.end())
it->second->OnResult(r);
}
@@ -553,14 +553,14 @@ public:
const Anope::string &n = redis.Get<const Anope::string>("name"),
&ip = redis.Get<const Anope::string>("ip");
int port = redis.Get<int>("port");
unsigned db = redis.Get<unsigned>("db");
auto db = redis.Get<unsigned>("db");
delete services[n];
services[n] = new MyRedisService(this, n, ip, port, db);
new_services.push_back(n);
}
for (std::map<Anope::string, MyRedisService *>::iterator it = services.begin(); it != services.end();)
for (auto it = services.begin(); it != services.end();)
{
Provider *p = it->second;
++it;
+2 -2
View File
@@ -48,7 +48,7 @@ public:
}
// Rate limit logins to 1/sec
time_t *last_login = na->nc->GetExt<time_t>("webcpanel_last_login");
auto *last_login = na->nc->GetExt<time_t>("webcpanel_last_login");
if (last_login != NULL && Anope::CurTime == *last_login)
{
this->OnFail();
@@ -113,7 +113,7 @@ bool WebCPanel::Index::OnRequest(HTTP::Provider *server, const Anope::string &pa
// Rate limit check.
Anope::string ip = client->clientaddr.addr();
Anope::unordered_map<time_t>::iterator it = last_login_attempt.find(ip);
auto it = last_login_attempt.find(ip);
if (it != last_login_attempt.end())
{
time_t last_time = it->second;
+2 -2
View File
@@ -37,7 +37,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTP::Provider *server, const Anope::s
}
if (message.post_data.count("greet") > 0)
{
Anope::string *greet = na->nc->GetExt<Anope::string>("greet");
auto *greet = na->nc->GetExt<Anope::string>("greet");
const Anope::string &post_greet = HTTP::URLDecode(message.post_data["greet"].replace_all_cs("+", " "));
if (post_greet.empty())
@@ -130,7 +130,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTP::Provider *server, const Anope::s
replacements["REGISTERED"] = Anope::strftime(na->nc->registered, na->nc);
if (na->HasVHost())
replacements["VHOST"] = na->GetVHostMask();
Anope::string *greet = na->nc->GetExt<Anope::string>("greet");
auto *greet = na->nc->GetExt<Anope::string>("greet");
if (greet)
replacements["GREET"] = *greet;
if (na->nc->HasExt("AUTOOP"))
+1 -1
View File
@@ -83,7 +83,7 @@ static Anope::string FindReplacement(const TemplateFileServer::Replacements &r,
}
}
TemplateFileServer::Replacements::const_iterator it = r.find(key);
auto it = r.find(key);
if (it != r.end())
return it->second;
return "";