1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 15:44:46 +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 "";
+3 -3
View File
@@ -46,7 +46,7 @@ void PrivilegeManager::AddPrivilege(Privilege p)
void PrivilegeManager::RemovePrivilege(Privilege &p)
{
std::vector<Privilege>::iterator it = std::find(Privileges.begin(), Privileges.end(), p);
auto it = std::find(Privileges.begin(), Privileges.end(), p);
if (it != Privileges.end())
Privileges.erase(it);
@@ -82,7 +82,7 @@ AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service(o, "
AccessProvider::~AccessProvider()
{
std::list<AccessProvider *>::iterator it = std::find(Providers.begin(), Providers.end(), this);
auto it = std::find(Providers.begin(), Providers.end(), this);
if (it != Providers.end())
Providers.erase(it);
}
@@ -104,7 +104,7 @@ ChanAccess::~ChanAccess()
{
if (this->ci)
{
std::vector<ChanAccess *>::iterator it = std::find(this->ci->access->begin(), this->ci->access->end(), this);
auto it = std::find(this->ci->access->begin(), this->ci->access->end(), this);
if (it != this->ci->access->end())
this->ci->access->erase(it);
+1 -1
View File
@@ -74,7 +74,7 @@ void IdentifyRequest::Dispatch()
void IdentifyRequest::ModuleUnload(Module *m)
{
for (std::set<IdentifyRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end;)
for (auto it = Requests.begin(), it_end = Requests.end(); it != it_end;)
{
IdentifyRequest *ir = *it;
++it;
+4 -4
View File
@@ -111,7 +111,7 @@ BotInfo::~BotInfo()
IRCD->SendSQLineDel(&x);
}
for (std::set<ChannelInfo *>::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end;)
for (auto it = this->channels->begin(), it_end = this->channels->end(); it != it_end;)
{
ChannelInfo *ci = *it++;
this->UnAssign(NULL, ci);
@@ -303,7 +303,7 @@ CommandInfo &BotInfo::SetCommand(const Anope::string &cname, const Anope::string
CommandInfo *BotInfo::GetCommand(const Anope::string &cname)
{
CommandInfo::map::iterator it = this->commands.find(cname);
auto it = this->commands.find(cname);
if (it != this->commands.end())
return &it->second;
return NULL;
@@ -345,7 +345,7 @@ BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only)
{
if (!nick_only && IRCD != NULL && IRCD->RequiresID)
{
botinfo_map::iterator it = BotListByUID->find(nick);
auto it = BotListByUID->find(nick);
if (it != BotListByUID->end())
{
BotInfo *bi = it->second;
@@ -357,7 +357,7 @@ BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only)
return NULL;
}
botinfo_map::iterator it = BotListByNick->find(nick);
auto it = BotListByNick->find(nick);
if (it != BotListByNick->end())
{
BotInfo *bi = it->second;
+9 -9
View File
@@ -169,7 +169,7 @@ void Channel::DeleteUser(User *user)
Membership *Channel::FindUser(User *u) const
{
ChanUserList::const_iterator it = this->users.find(u);
auto it = this->users.find(u);
if (it != this->users.end())
return it->second;
return NULL;
@@ -308,7 +308,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *ocm, const Mod
if (cm->type == MODE_LIST)
{
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
auto *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
cml->OnAdd(this, mdata.value);
}
@@ -366,7 +366,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const
if (cm->type == MODE_LIST)
{
for (Channel::ModeList::iterator it = modes.lower_bound(cm->name), it_end = modes.upper_bound(cm->name); it != it_end; ++it)
for (auto it = modes.lower_bound(cm->name), it_end = modes.upper_bound(cm->name); it != it_end; ++it)
if (param.equals_ci(it->second.value))
{
this->modes.erase(it);
@@ -378,7 +378,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const
if (cm->type == MODE_LIST)
{
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
auto *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
cml->OnDel(this, param);
}
@@ -416,7 +416,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data, bool e
return;
else if (cm->type == MODE_PARAM)
{
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
auto *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
if (!cmp->IsValid(mdata.value))
return;
@@ -432,7 +432,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data, bool e
}
else if (cm->type == MODE_LIST)
{
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
auto *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
if (!cml->IsValid(mdata.value))
return;
@@ -494,7 +494,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &wpar
if (cm->type == MODE_PARAM)
{
param.clear();
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
auto *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
if (!cmp->minus_no_arg)
this->GetParam(cmp->name, param);
}
@@ -676,7 +676,7 @@ void Channel::SetModesInternal(MessageSource &source, const Anope::string &modes
}
else 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)
{
@@ -948,7 +948,7 @@ BotInfo *Channel::WhoSends() const
Channel *Channel::Find(const Anope::string &name)
{
channel_map::const_iterator it = ChannelList.find(name);
auto it = ChannelList.find(name);
if (it != ChannelList.end())
return it->second;
+2 -2
View File
@@ -235,7 +235,7 @@ namespace
void HandleUnknownCommand(CommandSource& source, const Anope::string &message)
{
// Try to find a similar command.
size_t distance = Config->GetBlock("options").Get<size_t>("didyoumeandifference", "4");
auto distance = Config->GetBlock("options").Get<size_t>("didyoumeandifference", "4");
Anope::string similar;
auto umessage = message.upper();
for (const auto &[command, info] : source.service->commands)
@@ -282,7 +282,7 @@ bool Command::Run(CommandSource &source, const Anope::string &message)
std::vector<Anope::string> params;
spacesepstream(message).GetTokens(params);
CommandInfo::map::const_iterator it = source.service->commands.end();
auto it = source.service->commands.end();
unsigned count = 0;
for (unsigned max = params.size(); it == source.service->commands.end() && max > 0; --max)
{
+5 -5
View File
@@ -80,7 +80,7 @@ const Block::item_map &Block::GetItems() const
template<> const Anope::string Block::Get(const Anope::string &tag, const Anope::string &def) const
{
Anope::map<Anope::string>::const_iterator it = items.find(tag);
auto it = items.find(tag);
if (it != items.end())
return it->second;
@@ -611,7 +611,7 @@ void Conf::Post(Conf *old)
if (o->ot == NULL)
{
/* Oper block has lost type */
std::vector<Oper *>::iterator it = std::find(old->Opers.begin(), old->Opers.end(), o);
auto it = std::find(old->Opers.begin(), old->Opers.end(), o);
if (it != old->Opers.end())
old->Opers.erase(it);
@@ -652,7 +652,7 @@ Block &Conf::GetModule(const Module *m)
Block &Conf::GetModule(const Anope::string &mname)
{
std::map<Anope::string, Block *>::iterator it = modules.find(mname);
auto it = modules.find(mname);
if (it != modules.end())
return *it->second;
@@ -678,7 +678,7 @@ Block &Conf::GetModule(const Anope::string &mname)
BotInfo *Conf::GetClient(const Anope::string &cname)
{
Anope::map<Anope::string>::iterator it = bots.find(cname);
auto it = bots.find(cname);
if (it != bots.end())
return BotInfo::Find(!it->second.empty() ? it->second : cname, true);
@@ -895,7 +895,7 @@ void Conf::LoadConf(File &file)
}
Block *b = block_stack.empty() ? this : block_stack.top();
block_map::iterator it = b->blocks.emplace(wordbuffer, Configuration::Block(wordbuffer));
auto it = b->blocks.emplace(wordbuffer, Configuration::Block(wordbuffer));
b = &it->second;
b->linenum = linenumber;
block_stack.push(b);
+1 -1
View File
@@ -49,7 +49,7 @@ bool Extensible::HasExt(const Anope::string &name) const
void Extensible::ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data)
{
for (std::set<ExtensibleBase *>::iterator it = e->extension_items.begin(); it != e->extension_items.end(); ++it)
for (auto it = e->extension_items.begin(); it != e->extension_items.end(); ++it)
{
ExtensibleBase *eb = *it;
eb->ExtensibleSerialize(e, s, data);
+1 -1
View File
@@ -26,7 +26,7 @@ static unsigned char case_map_upper[256], case_map_lower[256];
/* called whenever Anope::casemap is modified to rebuild the casemap cache */
void Anope::CaseMapRebuild()
{
const std::ctype<char> &ct = std::use_facet<std::ctype<char> >(Anope::casemap);
const auto &ct = std::use_facet<std::ctype<char> >(Anope::casemap);
for (unsigned i = 0; i < sizeof(case_map_upper); ++i)
{
+2 -2
View File
@@ -31,7 +31,7 @@ Memo::~Memo()
{
if (mi)
{
std::vector<Memo *>::iterator it = std::find(mi->memos->begin(), mi->memos->end(), this);
auto it = std::find(mi->memos->begin(), mi->memos->end(), this);
if (it != mi->memos->end())
mi->memos->erase(it);
@@ -115,7 +115,7 @@ void MemoInfo::Del(unsigned index)
Memo *m = this->GetMemo(index);
std::vector<Memo *>::iterator it = std::find(memos->begin(), memos->end(), m);
auto it = std::find(memos->begin(), memos->end(), m);
if (it != memos->end())
memos->erase(it);
+1 -1
View File
@@ -90,7 +90,7 @@ void Join::Run(MessageSource &source, const std::vector<Anope::string> &params,
/* Special case for /join 0 */
if (channel == "0")
{
for (User::ChanUserList::iterator it = user->chans.begin(), it_end = user->chans.end(); it != it_end; )
for (auto it = user->chans.begin(), it_end = user->chans.end(); it != it_end; )
{
auto *memb = it->second;
Channel *c = memb->chan;
+1 -1
View File
@@ -105,7 +105,7 @@ void NumberList::Process()
if (this->desc)
{
for (std::set<unsigned>::reverse_iterator it = numbers.rbegin(), it_end = numbers.rend(); it != it_end; ++it)
for (auto it = numbers.rbegin(), it_end = numbers.rend(); it != it_end; ++it)
this->HandleNumber(*it);
}
else
+16 -16
View File
@@ -206,7 +206,7 @@ ChannelModeVirtual<T>::~ChannelModeVirtual()
{
if (basech)
{
std::vector<ChannelMode *>::iterator it = std::find(basech->listeners.begin(), basech->listeners.end(), this);
auto it = std::find(basech->listeners.begin(), basech->listeners.end(), this);
if (it != basech->listeners.end())
basech->listeners.erase(it);
}
@@ -325,7 +325,7 @@ public:
template<typename List, typename Object>
static StackerInfo *GetInfo(List &l, Object *o)
{
typename List::const_iterator it = l.find(o);
auto it = l.find(o);
if (it != l.end())
return it->second;
@@ -384,7 +384,7 @@ bool ModeManager::AddChannelMode(ChannelMode *cm)
if (cm->type == MODE_STATUS)
{
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
auto *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
unsigned want = cms->symbol;
if (want >= ChannelModesIdx.size())
ChannelModesIdx.resize(want + 1);
@@ -421,7 +421,7 @@ void ModeManager::RemoveUserMode(UserMode *um)
UserModesByName.erase(um->name);
std::vector<UserMode *>::iterator it = std::find(UserModes.begin(), UserModes.end(), um);
auto it = std::find(UserModes.begin(), UserModes.end(), um);
if (it != UserModes.end())
UserModes.erase(it);
@@ -447,7 +447,7 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm)
if (cm->type == MODE_STATUS)
{
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
auto *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
unsigned want = cms->symbol;
if (want >= ChannelModesIdx.size())
@@ -463,7 +463,7 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm)
ChannelModesByName.erase(cm->name);
std::vector<ChannelMode *>::iterator it = std::find(ChannelModes.begin(), ChannelModes.end(), cm);
auto it = std::find(ChannelModes.begin(), ChannelModes.end(), cm);
if (it != ChannelModes.end())
ChannelModes.erase(it);
@@ -490,7 +490,7 @@ UserMode *ModeManager::FindUserModeByChar(char mode)
ChannelMode *ModeManager::FindChannelModeByName(const Anope::string &name)
{
std::map<Anope::string, ChannelMode *>::iterator it = ChannelModesByName.find(name);
auto it = ChannelModesByName.find(name);
if (it != ChannelModesByName.end())
return it->second;
return NULL;
@@ -498,7 +498,7 @@ ChannelMode *ModeManager::FindChannelModeByName(const Anope::string &name)
UserMode *ModeManager::FindUserModeByName(const Anope::string &name)
{
std::map<Anope::string, UserMode *>::iterator it = UserModesByName.find(name);
auto it = UserModesByName.find(name);
if (it != UserModesByName.end())
return it->second;
return NULL;
@@ -614,7 +614,7 @@ void ModeManager::ProcessModes()
template<typename T>
static void StackerDel(std::map<T *, StackerInfo *> &map, T *obj)
{
typename std::map<T *, StackerInfo *>::iterator it = map.find(obj);
auto it = map.find(obj);
if (it != map.end())
{
StackerInfo *si = it->second;
@@ -636,12 +636,12 @@ void ModeManager::StackerDel(Channel *c)
void ModeManager::StackerDel(Mode *m)
{
for (std::map<User *, StackerInfo *>::const_iterator it = UserStackerObjects.begin(), it_end = UserStackerObjects.end(); it != it_end;)
for (auto it = UserStackerObjects.begin(), it_end = UserStackerObjects.end(); it != it_end;)
{
StackerInfo *si = it->second;
++it;
for (StackerInfo::ModeList::iterator it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;)
for (auto it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;)
{
if (it2->first == m)
it2 = si->AddModes.erase(it2);
@@ -649,7 +649,7 @@ void ModeManager::StackerDel(Mode *m)
++it2;
}
for (StackerInfo::ModeList::iterator it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;)
for (auto it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;)
{
if (it2->first == m)
it2 = si->DelModes.erase(it2);
@@ -658,12 +658,12 @@ void ModeManager::StackerDel(Mode *m)
}
}
for (std::map<Channel *, StackerInfo *>::const_iterator it = ChannelStackerObjects.begin(), it_end = ChannelStackerObjects.end(); it != it_end;)
for (auto it = ChannelStackerObjects.begin(), it_end = ChannelStackerObjects.end(); it != it_end;)
{
StackerInfo *si = it->second;
++it;
for (StackerInfo::ModeList::iterator it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;)
for (auto it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;)
{
if (it2->first == m)
it2 = si->AddModes.erase(it2);
@@ -671,7 +671,7 @@ void ModeManager::StackerDel(Mode *m)
++it2;
}
for (StackerInfo::ModeList::iterator it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;)
for (auto it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;)
{
if (it2->first == m)
it2 = si->DelModes.erase(it2);
@@ -804,7 +804,7 @@ bool Entry::Matches(User *u, bool full) const
ChannelMode *cm = ModeManager::FindChannelModeByName(this->name);
if (cm != NULL && cm->type == MODE_LIST)
{
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
auto *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
return cml->Matches(u, this);
}
}
+2 -2
View File
@@ -81,12 +81,12 @@ Module::~Module()
/* Clear any active timers this module has */
TimerManager::DeleteTimersFor(this);
std::list<Module *>::iterator it = std::find(ModuleManager::Modules.begin(), ModuleManager::Modules.end(), this);
auto it = std::find(ModuleManager::Modules.begin(), ModuleManager::Modules.end(), this);
if (it != ModuleManager::Modules.end())
ModuleManager::Modules.erase(it);
#if HAVE_LOCALIZATION
std::vector<Anope::string>::iterator dit = std::find(Language::Domains.begin(), Language::Domains.end(), this->name);
auto dit = std::find(Language::Domains.begin(), Language::Domains.end(), this->name);
if (dit != Language::Domains.end())
Language::Domains.erase(dit);
#endif
+4 -4
View File
@@ -149,7 +149,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
}
dlerror();
Module *(*func)(const Anope::string &, const Anope::string &) = function_cast<Module *(*)(const Anope::string &, const Anope::string &)>(dlsym(handle, "AnopeInit"));
auto *func = function_cast<Module *(*)(const Anope::string &, const Anope::string &)>(dlsym(handle, "AnopeInit"));
err = dlerror();
if (!func)
{
@@ -233,7 +233,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
ModuleVersion ModuleManager::GetVersion(void *handle)
{
dlerror();
ModuleVersionC (*func)() = function_cast<ModuleVersionC (*)()>(dlsym(handle, "AnopeVersion"));;
auto *func = function_cast<ModuleVersionC (*)()>(dlsym(handle, "AnopeVersion"));;
if (!func)
{
Log() << "No version function found, not an Anope module";
@@ -314,7 +314,7 @@ ModuleReturn ModuleManager::DeleteModule(Module *m)
Log(LOG_DEBUG) << "Unloading module " << m->name;
dlerror();
void (*destroy_func)(Module *m) = function_cast<void (*)(Module *)>(dlsym(m->handle, "AnopeFini"));
auto *destroy_func = function_cast<void (*)(Module *)>(dlsym(m->handle, "AnopeFini"));
const char *err = dlerror();
if (!destroy_func || (err && *err))
{
@@ -339,7 +339,7 @@ void ModuleManager::DetachAll(Module *mod)
{
for (auto &mods : EventHandlers)
{
std::vector<Module *>::iterator it2 = std::find(mods.begin(), mods.end(), mod);
auto it2 = std::find(mods.begin(), mods.end(), mod);
if (it2 != mods.end())
mods.erase(it2);
}
+3 -3
View File
@@ -61,7 +61,7 @@ NickAlias::~NickAlias()
if (this->nc)
{
/* Next: see if our core is still useful. */
std::vector<NickAlias *>::iterator it = std::find(this->nc->aliases->begin(), this->nc->aliases->end(), this);
auto it = std::find(this->nc->aliases->begin(), this->nc->aliases->end(), this);
if (it != this->nc->aliases->end())
this->nc->aliases->erase(it);
if (this->nc->aliases->empty())
@@ -139,7 +139,7 @@ void NickAlias::UpdateSeen(User *u)
NickAlias *NickAlias::Find(const Anope::string &nick)
{
nickalias_map::const_iterator it = NickAliasList->find(nick);
auto it = NickAliasList->find(nick);
if (it != NickAliasList->end())
{
it->second->QueueUpdate();
@@ -203,7 +203,7 @@ Serializable *NickAlias::Type::Unserialize(Serializable *obj, Serialize::Data &d
if (na->nc != core)
{
std::vector<NickAlias *>::iterator it = std::find(na->nc->aliases->begin(), na->nc->aliases->end(), na);
auto it = std::find(na->nc->aliases->begin(), na->nc->aliases->end(), na);
if (it != na->nc->aliases->end())
na->nc->aliases->erase(it);
+2 -2
View File
@@ -50,7 +50,7 @@ NickCore::~NickCore()
if (!this->chanaccess->empty())
Log(LOG_DEBUG) << "Non-empty chanaccess list in destructor!";
for (std::list<User *>::iterator it = this->users.begin(); it != this->users.end();)
for (auto it = this->users.begin(); it != this->users.end();)
{
User *user = *it++;
user->Logout();
@@ -243,7 +243,7 @@ void NickCore::GetChannelReferences(std::deque<ChannelInfo *> &queue)
NickCore *NickCore::Find(const Anope::string &nick)
{
nickcore_map::const_iterator it = NickCoreList->find(nick);
auto it = NickCoreList->find(nick);
if (it != NickCoreList->end())
{
it->second->QueueUpdate();
+1 -1
View File
@@ -28,7 +28,7 @@ Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o)
Oper::~Oper()
{
std::vector<Oper *>::iterator it = std::find(opers.begin(), opers.end(), this);
auto it = std::find(opers.begin(), opers.end(), this);
if (it != opers.end())
opers.erase(it);
}
+2 -2
View File
@@ -466,7 +466,7 @@ int16_t ChannelInfo::GetLevel(const Anope::string &priv) const
return ACCESS_INVALID;
}
Anope::map<int16_t>::const_iterator it = this->levels.find(priv);
auto it = this->levels.find(priv);
if (it == this->levels.end())
return 0;
return it->second;
@@ -514,7 +514,7 @@ Anope::string ChannelInfo::GetIdealBan(User *u) const
ChannelInfo *ChannelInfo::Find(const Anope::string &name)
{
registered_channel_map::const_iterator it = RegisteredChannelList->find(name);
auto it = RegisteredChannelList->find(name);
if (it != RegisteredChannelList->end())
{
it->second->QueueUpdate();
+1 -1
View File
@@ -208,7 +208,7 @@ void Type::UpdateTimestamp()
Type *Serialize::Type::Find(const Anope::string &name)
{
std::map<Anope::string, Type *>::iterator it = Types.find(name);
auto it = Types.find(name);
if (it != Types.end())
return it->second;
return NULL;
+1 -1
View File
@@ -272,7 +272,7 @@ void Server::Sync(bool sync_links)
FOREACH_MOD(OnPreUplinkSync, (this));
}
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;
+1 -1
View File
@@ -93,7 +93,7 @@ void SocketEngine::Process()
{
epoll_event &ev = events[i];
std::map<int, Socket *>::iterator it = Sockets.find(ev.data.fd);
auto it = Sockets.find(ev.data.fd);
if (it == Sockets.end())
continue;
Socket *s = it->second;
+1 -1
View File
@@ -20,7 +20,7 @@
static void *entry_point(void *parameter)
{
Thread *thread = static_cast<Thread *>(parameter);
auto *thread = static_cast<Thread *>(parameter);
thread->Run();
thread->SetExitState();
return NULL;
+3 -3
View File
@@ -84,7 +84,7 @@ void TimerManager::AddTimer(Timer *t)
void TimerManager::DelTimer(Timer *t)
{
std::pair<std::multimap<time_t, Timer *>::iterator, std::multimap<time_t, Timer *>::iterator> itpair = Timers.equal_range(t->GetTimer());
for (std::multimap<time_t, Timer *>::iterator i = itpair.first; i != itpair.second; ++i)
for (auto i = itpair.first; i != itpair.second; ++i)
{
if (i->second == t)
{
@@ -98,7 +98,7 @@ void TimerManager::TickTimers()
{
while (!Timers.empty())
{
std::multimap<time_t, Timer *>::iterator it = Timers.begin();
auto it = Timers.begin();
Timer *t = it->second;
if (t->GetTimer() > Anope::CurTime)
@@ -115,7 +115,7 @@ void TimerManager::TickTimers()
void TimerManager::DeleteTimersFor(Module *m)
{
for (std::multimap<time_t, Timer *>::iterator it = Timers.begin(), it_next = it; it != Timers.end(); it = it_next)
for (auto it = Timers.begin(), it_next = it; it != Timers.end(); it = it_next)
{
++it_next;
if (it->second->GetOwner() == m)
+5 -5
View File
@@ -99,7 +99,7 @@ static void CollideKill(User *target, const Anope::string &reason)
IRCD->SendQuit(target, reason);
// Reintroduce my client
if (BotInfo *bi = dynamic_cast<BotInfo *>(target))
if (auto *bi = dynamic_cast<BotInfo *>(target))
bi->OnKill();
else
target->Quit(reason);
@@ -415,7 +415,7 @@ void User::Logout()
Log(this, "account") << "is no longer identified as " << this->nc->display;
std::list<User *>::iterator it = std::find(this->nc->users.begin(), this->nc->users.end(), this);
auto it = std::find(this->nc->users.begin(), this->nc->users.end(), this);
if (it != this->nc->users.end())
this->nc->users.erase(it);
@@ -741,7 +741,7 @@ const User::ModeList &User::GetModeList() const
Membership *User::FindChannel(Channel *c) const
{
User::ChanUserList::const_iterator it = this->chans.find(c);
auto it = this->chans.find(c);
if (it != this->chans.end())
return it->second;
return NULL;
@@ -854,7 +854,7 @@ User *User::Find(const Anope::string &name, bool nick_only)
{
if (!nick_only && IRCD && IRCD->RequiresID)
{
user_map::iterator it = UserListByUID.find(name);
auto it = UserListByUID.find(name);
if (it != UserListByUID.end())
return it->second;
@@ -862,7 +862,7 @@ User *User::Find(const Anope::string &name, bool nick_only)
return NULL;
}
user_map::iterator it = UserListByNick.find(name);
auto it = UserListByNick.find(name);
if (it != UserListByNick.end())
return it->second;
+7 -7
View File
@@ -238,7 +238,7 @@ void XLineManager::RegisterXLineManager(XLineManager *xlm)
void XLineManager::UnregisterXLineManager(XLineManager *xlm)
{
std::list<XLineManager *>::iterator it = std::find(XLineManagers.begin(), XLineManagers.end(), xlm);
auto it = std::find(XLineManagers.begin(), XLineManagers.end(), xlm);
if (it != XLineManagers.end())
XLineManagers.erase(it);
@@ -320,11 +320,11 @@ void XLineManager::RemoveXLine(XLine *x)
{
/* called from the destructor */
std::vector<XLine *>::iterator it = std::find(this->xlines->begin(), this->xlines->end(), x);
auto it = std::find(this->xlines->begin(), this->xlines->end(), x);
if (!x->id.empty())
{
std::multimap<Anope::string, XLine *, ci::less>::iterator it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id);
auto it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id);
for (; it2 != XLinesByUID->end() && it2 != it3; ++it2)
if (it2->second == x)
{
@@ -342,11 +342,11 @@ void XLineManager::RemoveXLine(XLine *x)
bool XLineManager::DelXLine(XLine *x)
{
std::vector<XLine *>::iterator it = std::find(this->xlines->begin(), this->xlines->end(), x);
auto it = std::find(this->xlines->begin(), this->xlines->end(), x);
if (!x->id.empty())
{
std::multimap<Anope::string, XLine *, ci::less>::iterator it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id);
auto it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id);
for (; it2 != XLinesByUID->end() && it2 != it3; ++it2)
if (it2->second == x)
{
@@ -441,9 +441,9 @@ bool XLineManager::CanAdd(CommandSource &source, const Anope::string &mask, time
XLine *XLineManager::HasEntry(const Anope::string &mask)
{
std::multimap<Anope::string, XLine *, ci::less>::iterator it = XLinesByUID->find(mask);
auto it = XLinesByUID->find(mask);
if (it != XLinesByUID->end())
for (std::multimap<Anope::string, XLine *, ci::less>::iterator it2 = XLinesByUID->upper_bound(mask); it != it2; ++it)
for (auto it2 = XLinesByUID->upper_bound(mask); it != it2; ++it)
if (it->second->manager == NULL || it->second->manager == this)
{
it->second->QueueUpdate();