mirror of
https://github.com/anope/anope.git
synced 2026-06-12 17:24:49 +02:00
Use auto in as many places as possible.
This commit is contained in:
@@ -147,7 +147,7 @@ struct BadWordsImpl final
|
|||||||
|
|
||||||
BadWordsImpl::~BadWordsImpl()
|
BadWordsImpl::~BadWordsImpl()
|
||||||
{
|
{
|
||||||
for (list::iterator it = badwords->begin(); it != badwords->end();)
|
for (auto it = badwords->begin(); it != badwords->end();)
|
||||||
{
|
{
|
||||||
auto *bw = *it;
|
auto *bw = *it;
|
||||||
++it;
|
++it;
|
||||||
@@ -160,10 +160,10 @@ BadWordImpl::~BadWordImpl()
|
|||||||
ChannelInfo *ci = ChannelInfo::Find(chan);
|
ChannelInfo *ci = ChannelInfo::Find(chan);
|
||||||
if (ci)
|
if (ci)
|
||||||
{
|
{
|
||||||
BadWordsImpl *badwords = ci->GetExt<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
|
auto *badwords = ci->GetExt<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
|
||||||
if (badwords)
|
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())
|
if (it != badwords->badwords->end())
|
||||||
badwords->badwords->erase(it);
|
badwords->badwords->erase(it);
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ Serializable *BadWordTypeImpl::Unserialize(Serializable *obj, Serialize::Data &d
|
|||||||
bw->word = sword;
|
bw->word = sword;
|
||||||
bw->type = StringToType(n);
|
bw->type = StringToType(n);
|
||||||
|
|
||||||
BadWordsImpl *bws = ci->Require<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
|
auto *bws = ci->Require<BadWordsImpl>(BOTSERV_BAD_WORDS_EXT);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
bws->badwords->push_back(bw);
|
bws->badwords->push_back(bw);
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ private:
|
|||||||
realword = word.substr(0, pos);
|
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)
|
if (badwords->GetBadWordCount() >= badwordsmax)
|
||||||
{
|
{
|
||||||
source.Reply(_("You can only have %d bad words entries on a channel."), badwordsmax);
|
source.Reply(_("You can only have %d bad words entries on a channel."), badwordsmax);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ struct KickerDataImpl final
|
|||||||
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
||||||
return;
|
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);
|
auto *kd = this->Get(ci);
|
||||||
if (kd == NULL)
|
if (kd == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -85,7 +85,7 @@ struct KickerDataImpl final
|
|||||||
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
||||||
return;
|
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);
|
auto *kd = ci->Require<BotServ::KickerData>(BOTSERV_KICKER_DATA_EXT);
|
||||||
|
|
||||||
data["kickerdata:amsgs"] >> kd->amsgs;
|
data["kickerdata:amsgs"] >> kd->amsgs;
|
||||||
@@ -988,7 +988,7 @@ public:
|
|||||||
void purge()
|
void purge()
|
||||||
{
|
{
|
||||||
time_t keepdata = Config->GetModule(me).Get<time_t>("keepdata");
|
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;
|
const Anope::string &user = it->first;
|
||||||
Data &bd = it->second;
|
Data &bd = it->second;
|
||||||
@@ -1038,7 +1038,7 @@ public:
|
|||||||
|
|
||||||
for (auto &[_, c] : ChannelList)
|
for (auto &[_, c] : ChannelList)
|
||||||
{
|
{
|
||||||
BanData *bd = c->GetExt<BanData>("bandata");
|
auto *bd = c->GetExt<BanData>("bandata");
|
||||||
if (bd != NULL)
|
if (bd != NULL)
|
||||||
{
|
{
|
||||||
bd->purge();
|
bd->purge();
|
||||||
@@ -1488,7 +1488,7 @@ public:
|
|||||||
|
|
||||||
if (ud->lastline.equals_ci(realbuf) && !ud->lasttarget.empty() && !ud->lasttarget.equals_ci(ci->name))
|
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;
|
Channel *chan = it->second->chan;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ public:
|
|||||||
if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly)
|
if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly)
|
||||||
return;
|
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;
|
ChannelInfo *ci = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -369,7 +369,7 @@ public:
|
|||||||
if (ci->c)
|
if (ci->c)
|
||||||
{
|
{
|
||||||
time_t last_used = ci->last_used;
|
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);
|
ci->AccessFor(cit->second->user);
|
||||||
expire = last_used == ci->last_used;
|
expire = last_used == ci->last_used;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ private:
|
|||||||
ServiceReference<AccessProvider> provider("AccessProvider", "access/access");
|
ServiceReference<AccessProvider> provider("AccessProvider", "access/access");
|
||||||
if (!provider)
|
if (!provider)
|
||||||
return;
|
return;
|
||||||
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
|
auto *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
|
||||||
access->SetMask(mask, ci);
|
access->SetMask(mask, ci);
|
||||||
access->creator = source.GetNick();
|
access->creator = source.GetNick();
|
||||||
access->level = level;
|
access->level = level;
|
||||||
@@ -960,7 +960,7 @@ public:
|
|||||||
/* Access accessprovider is the only accessprovider with the concept of negative access,
|
/* Access accessprovider is the only accessprovider with the concept of negative access,
|
||||||
* so check they don't have 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)
|
if (aca->level < 0)
|
||||||
return EVENT_CONTINUE;
|
return EVENT_CONTINUE;
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class CommandCSAKick final
|
|||||||
return;
|
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;
|
auto *memb = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -223,7 +223,7 @@ class CommandCSAKick final
|
|||||||
const NickAlias *na = NickAlias::Find(mask);
|
const NickAlias *na = NickAlias::Find(mask);
|
||||||
NickCore *nc = NULL;
|
NickCore *nc = NULL;
|
||||||
const ChanServ::AutoKick *akick;
|
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)
|
if (reason.length() > reasonmax)
|
||||||
reason = reason.substr(0, reasonmax);
|
reason = reason.substr(0, reasonmax);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
reason += " " + params[3];
|
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)
|
if (reason.length() > reasonmax)
|
||||||
reason = reason.substr(0, reasonmax);
|
reason = reason.substr(0, reasonmax);
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int matched = 0, kicked = 0;
|
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;
|
auto *memb = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class CommandCSClone final
|
|||||||
static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
|
static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
|
||||||
{
|
{
|
||||||
std::set<Anope::string> masks;
|
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;
|
unsigned count = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
|
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ private:
|
|||||||
|
|
||||||
std::vector<User *> users;
|
std::vector<User *> users;
|
||||||
/* The newer users are at the end of the list, so kick users starting from the end */
|
/* 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;
|
auto *memb = it->second;
|
||||||
User *user = memb->user;
|
User *user = memb->user;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ Serializable *EntryMsgTypeImpl::Unserialize(Serializable *obj, Serialize::Data &
|
|||||||
|
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
EntryMsgImpl *msg = anope_dynamic_static_cast<EntryMsgImpl *>(obj);
|
auto *msg = anope_dynamic_static_cast<EntryMsgImpl *>(obj);
|
||||||
msg->chan = ci->name;
|
msg->chan = ci->name;
|
||||||
data["creator"] >> msg->creator;
|
data["creator"] >> msg->creator;
|
||||||
data["message"] >> msg->message;
|
data["message"] >> msg->message;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
bool HasPriv(const Anope::string &priv) const override
|
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;
|
return it != defaultFlags.end() && this->flags.count(it->second) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ class CommandCSFlags final
|
|||||||
ServiceReference<AccessProvider> provider("AccessProvider", "access/flags");
|
ServiceReference<AccessProvider> provider("AccessProvider", "access/flags");
|
||||||
if (!provider)
|
if (!provider)
|
||||||
return;
|
return;
|
||||||
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
auto *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
||||||
access->SetMask(mask, ci);
|
access->SetMask(mask, ci);
|
||||||
access->creator = source.GetNick();
|
access->creator = source.GetNick();
|
||||||
access->description = current ? current->description : description;
|
access->description = current ? current->description : description;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
|
auto reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
|
||||||
if (reason.length() > reasonmax)
|
if (reason.length() > reasonmax)
|
||||||
reason = reason.substr(0, reasonmax);
|
reason = reason.substr(0, reasonmax);
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
Log(LOG_COMMAND, source, this, ci) << "for " << mask;
|
Log(LOG_COMMAND, source, this, ci) << "for " << mask;
|
||||||
|
|
||||||
int matched = 0, kicked = 0;
|
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;
|
auto *memb = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Anope::string spattern = "#" + pattern;
|
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());
|
source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str());
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
auto *memb = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -1102,7 +1102,7 @@ public:
|
|||||||
Anope::string param;
|
Anope::string param;
|
||||||
if (cm->type == MODE_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)
|
if (add || !cmp->minus_no_arg)
|
||||||
{
|
{
|
||||||
sep.GetToken(param);
|
sep.GetToken(param);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
{
|
{
|
||||||
const Anope::string &chan = params[0];
|
const Anope::string &chan = params[0];
|
||||||
const Anope::string &chdesc = params.size() > 1 ? params[1] : "";
|
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();
|
User *u = source.GetUser();
|
||||||
NickCore *nc = source.nc;
|
NickCore *nc = source.nc;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct SeenInfo final
|
|||||||
|
|
||||||
~SeenInfo() override
|
~SeenInfo() override
|
||||||
{
|
{
|
||||||
database_map::iterator iter = database.find(nick);
|
auto iter = database.find(nick);
|
||||||
if (iter != database.end() && iter->second == this)
|
if (iter != database.end() && iter->second == this)
|
||||||
database.erase(iter);
|
database.erase(iter);
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ struct SeenInfoType final
|
|||||||
|
|
||||||
static SeenInfo *FindInfo(const Anope::string &nick)
|
static SeenInfo *FindInfo(const Anope::string &nick)
|
||||||
{
|
{
|
||||||
database_map::iterator iter = database.find(nick);
|
auto iter = database.find(nick);
|
||||||
if (iter != database.end())
|
if (iter != database.end())
|
||||||
return iter->second;
|
return iter->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -203,7 +203,7 @@ public:
|
|||||||
time = Anope::CurTime - time;
|
time = Anope::CurTime - time;
|
||||||
database_map::iterator buf;
|
database_map::iterator buf;
|
||||||
size_t counter = 0;
|
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;
|
buf = it;
|
||||||
++it;
|
++it;
|
||||||
@@ -379,9 +379,9 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto previous_size = database.size();
|
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;
|
++it;
|
||||||
|
|
||||||
if ((Anope::CurTime - cur->second->last) > purgetime)
|
if ((Anope::CurTime - cur->second->last) > purgetime)
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
NickCore *nc = na->nc;
|
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"))
|
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());
|
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
|
||||||
@@ -1018,7 +1018,7 @@ public:
|
|||||||
"channel will be dropped."
|
"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)
|
if (max_reg)
|
||||||
{
|
{
|
||||||
source.Reply(" ");
|
source.Reply(" ");
|
||||||
@@ -1112,7 +1112,7 @@ class CSSet final
|
|||||||
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(s);
|
const auto *ci = anope_dynamic_static_cast<const ChannelInfo *>(s);
|
||||||
Anope::string modes;
|
Anope::string modes;
|
||||||
for (const auto &[last_mode, last_data] : ci->last_modes)
|
for (const auto &[last_mode, last_data] : ci->last_modes)
|
||||||
{
|
{
|
||||||
@@ -1138,7 +1138,7 @@ class CSSet final
|
|||||||
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ChannelInfo *ci = anope_dynamic_static_cast<ChannelInfo *>(s);
|
auto *ci = anope_dynamic_static_cast<ChannelInfo *>(s);
|
||||||
Anope::string modes;
|
Anope::string modes;
|
||||||
data["last_modes"] >> modes;
|
data["last_modes"] >> modes;
|
||||||
ci->last_modes.clear();
|
ci->last_modes.clear();
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
for (auto idx = reason_idx; idx < params.size(); ++idx)
|
for (auto idx = reason_idx; idx < params.size(); ++idx)
|
||||||
reason.append(reason.empty() ? "" : " ").append(params[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->what = ci->name;
|
||||||
si->by = source.GetNick();
|
si->by = source.GetNick();
|
||||||
si->reason = reason;
|
si->reason = reason;
|
||||||
@@ -186,7 +186,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Only UNSUSPEND already suspended channels */
|
/* Only UNSUSPEND already suspended channels */
|
||||||
CSSuspendInfo *si = ci->GetExt<CSSuspendInfo>("CS_SUSPENDED");
|
auto *si = ci->GetExt<CSSuspendInfo>("CS_SUSPENDED");
|
||||||
if (!si)
|
if (!si)
|
||||||
{
|
{
|
||||||
source.Reply(_("Channel \002%s\002 isn't suspended."), ci->name.c_str());
|
source.Reply(_("Channel \002%s\002 isn't suspended."), ci->name.c_str());
|
||||||
@@ -254,7 +254,7 @@ public:
|
|||||||
|
|
||||||
void OnReload(Configuration::Conf &conf) override
|
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);
|
commasepstream(s).GetTokens(show);
|
||||||
std::transform(show.begin(), show.end(), show.begin(), trim());
|
std::transform(show.begin(), show.end(), show.begin(), trim());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!source.GetUser())
|
if (!source.GetUser())
|
||||||
return;
|
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;
|
Channel *c = it->second->chan;
|
||||||
SetModes(source.GetUser(), c);
|
SetModes(source.GetUser(), c);
|
||||||
@@ -162,7 +162,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!source.GetUser())
|
if (!source.GetUser())
|
||||||
return;
|
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;
|
Channel *c = it->second->chan;
|
||||||
RemoveAll(source.GetUser(), c);
|
RemoveAll(source.GetUser(), c);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
bool HasPriv(const Anope::string &priv) const override
|
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];
|
const std::vector<Anope::string> &privs = permissions[*it];
|
||||||
if (std::find(privs.begin(), privs.end(), priv) != privs.end())
|
if (std::find(privs.begin(), privs.end(), priv) != privs.end())
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (access->provider->name == "access/xop")
|
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;
|
return xaccess->type;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -128,7 +128,7 @@ private:
|
|||||||
bool override = false;
|
bool override = false;
|
||||||
const NickAlias *na = NULL;
|
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();
|
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))
|
if (!access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
|
||||||
@@ -252,7 +252,7 @@ private:
|
|||||||
ServiceReference<AccessProvider> provider("AccessProvider", "access/xop");
|
ServiceReference<AccessProvider> provider("AccessProvider", "access/xop");
|
||||||
if (!provider)
|
if (!provider)
|
||||||
return;
|
return;
|
||||||
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
|
auto *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
|
||||||
acc->SetMask(mask, ci);
|
acc->SetMask(mask, ci);
|
||||||
acc->creator = source.GetNick();
|
acc->creator = source.GetNick();
|
||||||
acc->description = description;
|
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();
|
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))
|
if (!mask.equals_ci(nc->display) && !access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ class MChanstats final
|
|||||||
for (int i = 0; i < r.Rows(); ++i)
|
for (int i = 0; i < r.Rows(); ++i)
|
||||||
{
|
{
|
||||||
const std::map<Anope::string, Anope::string> &map = r.Row(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);
|
TableList.push_back(it->second);
|
||||||
}
|
}
|
||||||
query = "SHOW PROCEDURE STATUS WHERE `Db` = Database();";
|
query = "SHOW PROCEDURE STATUS WHERE `Db` = Database();";
|
||||||
@@ -254,7 +254,7 @@ class MChanstats final
|
|||||||
|
|
||||||
bool HasTable(const Anope::string &table)
|
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)
|
if (*it == table)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -262,7 +262,7 @@ class MChanstats final
|
|||||||
|
|
||||||
bool HasProcedure(const Anope::string &table)
|
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)
|
if (*it == table)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -270,7 +270,7 @@ class MChanstats final
|
|||||||
|
|
||||||
bool HasEvent(const Anope::string &table)
|
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)
|
if (*it == table)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+7
-7
@@ -729,7 +729,7 @@ public:
|
|||||||
delete udpsock;
|
delete udpsock;
|
||||||
delete tcpsock;
|
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;
|
Request *request = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -909,7 +909,7 @@ public:
|
|||||||
return true;
|
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())
|
if (it == this->requests.end())
|
||||||
{
|
{
|
||||||
Log(LOG_DEBUG_2) << "Resolver: Received an answer for something we didn't request";
|
Log(LOG_DEBUG_2) << "Resolver: Received an answer for something we didn't request";
|
||||||
@@ -1043,7 +1043,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool CheckCache(Request *request)
|
bool CheckCache(Request *request)
|
||||||
{
|
{
|
||||||
cache_map::iterator it = this->cache.find(*request);
|
auto it = this->cache.find(*request);
|
||||||
if (it != this->cache.end())
|
if (it != this->cache.end())
|
||||||
{
|
{
|
||||||
Query &record = it->second;
|
Query &record = it->second;
|
||||||
@@ -1070,7 +1070,7 @@ public:
|
|||||||
|
|
||||||
~ModuleDNS() override
|
~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;
|
Socket *s = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -1096,8 +1096,8 @@ public:
|
|||||||
for (int i = 0; i < block.CountBlock("notify"); ++i)
|
for (int i = 0; i < block.CountBlock("notify"); ++i)
|
||||||
{
|
{
|
||||||
const auto &n = block.GetBlock("notify", i);
|
const auto &n = block.GetBlock("notify", i);
|
||||||
Anope::string nip = n.Get<Anope::string>("ip");
|
auto nip = n.Get<Anope::string>("ip");
|
||||||
short nport = n.Get<short>("port");
|
auto nport = n.Get<short>("port");
|
||||||
|
|
||||||
notify.emplace_back(nip, nport);
|
notify.emplace_back(nip, nport);
|
||||||
}
|
}
|
||||||
@@ -1149,7 +1149,7 @@ public:
|
|||||||
|
|
||||||
void OnModuleUnload(User *u, Module *m) override
|
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;
|
unsigned short id = it->first;
|
||||||
Request *req = it->second;
|
Request *req = it->second;
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@ public:
|
|||||||
if (params.empty())
|
if (params.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CommandInfo::map::const_iterator it = Config->Fantasy.end();
|
auto it = Config->Fantasy.end();
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
for (unsigned max = params.size(); it == Config->Fantasy.end() && max > 0; --max)
|
for (unsigned max = params.size(); it == Config->Fantasy.end() && max > 0; --max)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -138,7 +138,7 @@ public:
|
|||||||
full_command += " " + params[i];
|
full_command += " " + params[i];
|
||||||
full_command.erase(full_command.begin());
|
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())
|
if (it == map.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -354,7 +354,7 @@ public:
|
|||||||
|
|
||||||
~HTTPD() override
|
~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;
|
Socket *s = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -447,7 +447,7 @@ public:
|
|||||||
spacesepstream(ext_header).GetTokens(p->ext_headers);
|
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;
|
HTTP::Provider *p = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
, nick(na->nick)
|
, nick(na->nick)
|
||||||
{
|
{
|
||||||
/* Erase the current release timer and use the new one */
|
/* 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())
|
if (nit != NickServReleases.end())
|
||||||
{
|
{
|
||||||
IRCD->SendQuit(nit->second);
|
IRCD->SendQuit(nit->second);
|
||||||
@@ -379,7 +379,7 @@ public:
|
|||||||
Log(NickServ, "nick") << "Deleting account " << nc->display;
|
Log(NickServ, "nick") << "Deleting account " << nc->display;
|
||||||
|
|
||||||
/* Clean up this nick core from any users online */
|
/* 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++;
|
User *user = *it++;
|
||||||
IRCD->SendLogout(user);
|
IRCD->SendLogout(user);
|
||||||
@@ -610,7 +610,7 @@ public:
|
|||||||
|
|
||||||
time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y");
|
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;
|
NickAlias *na = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ struct AJoinEntry final
|
|||||||
|
|
||||||
~AJoinEntry() override
|
~AJoinEntry() override
|
||||||
{
|
{
|
||||||
AJoinList *channels = owner->GetExt<AJoinList>("ajoinlist");
|
auto *channels = owner->GetExt<AJoinList>("ajoinlist");
|
||||||
if (channels)
|
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())
|
if (it != (*channels)->end())
|
||||||
(*channels)->erase(it);
|
(*channels)->erase(it);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ struct AJoinEntryType final
|
|||||||
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
|
auto *channels = nc->Require<AJoinList>("ajoinlist");
|
||||||
(*channels)->push_back(aj);
|
(*channels)->push_back(aj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ class CommandNSAJoin final
|
|||||||
{
|
{
|
||||||
static void DoList(CommandSource &source, NickCore *nc)
|
static void DoList(CommandSource &source, NickCore *nc)
|
||||||
{
|
{
|
||||||
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
|
auto *channels = nc->Require<AJoinList>("ajoinlist");
|
||||||
|
|
||||||
if ((*channels)->empty())
|
if ((*channels)->empty())
|
||||||
source.Reply(_("%s's auto join list is empty."), nc->display.c_str());
|
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)
|
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &chans, const Anope::string &keys)
|
||||||
{
|
{
|
||||||
const auto ajoinmax = Config->GetModule(this->owner).Get<unsigned>("ajoinmax");
|
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 addedchans;
|
||||||
Anope::string alreadyadded;
|
Anope::string alreadyadded;
|
||||||
@@ -208,7 +208,7 @@ class CommandNSAJoin final
|
|||||||
|
|
||||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &chans)
|
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 delchans;
|
||||||
Anope::string notfoundchans;
|
Anope::string notfoundchans;
|
||||||
commasepstream sep(chans);
|
commasepstream sep(chans);
|
||||||
@@ -344,7 +344,7 @@ public:
|
|||||||
if (!NickServ)
|
if (!NickServ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AJoinList *channels = u->Account()->GetExt<AJoinList>("ajoinlist");
|
auto *channels = u->Account()->GetExt<AJoinList>("ajoinlist");
|
||||||
if (channels == NULL)
|
if (channels == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public:
|
|||||||
|
|
||||||
NickAlias *target, *na = NickAlias::Find(source.GetNick());
|
NickAlias *target, *na = NickAlias::Find(source.GetNick());
|
||||||
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
|
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)))
|
if (!(target = NickAlias::Find(nick)))
|
||||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||||
else if (user && Anope::CurTime < user->lastnickreg + reg_delay)
|
else if (user && Anope::CurTime < user->lastnickreg + reg_delay)
|
||||||
@@ -258,7 +258,7 @@ public:
|
|||||||
{
|
{
|
||||||
NickCore *oldcore = na->nc;
|
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())
|
if (it != oldcore->aliases->end())
|
||||||
oldcore->aliases->erase(it);
|
oldcore->aliases->erase(it);
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
return;
|
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)
|
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);
|
source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!u->chans.empty())
|
if (!u->chans.empty())
|
||||||
{
|
{
|
||||||
NSRecoverInfo *ei = source.GetUser()->Extend<NSRecoverInfo>("recover");
|
auto *ei = source.GetUser()->Extend<NSRecoverInfo>("recover");
|
||||||
for (auto &[chan, cuc] : u->chans)
|
for (auto &[chan, cuc] : u->chans)
|
||||||
(*ei)[chan->name] = cuc->status;
|
(*ei)[chan->name] = cuc->status;
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
|
|
||||||
if (IRCD->CanSVSNick)
|
if (IRCD->CanSVSNick)
|
||||||
{
|
{
|
||||||
NSRecoverSvsnick *svs = u->Extend<NSRecoverSvsnick>("svsnick");
|
auto *svs = u->Extend<NSRecoverSvsnick>("svsnick");
|
||||||
svs->from = source.GetUser();
|
svs->from = source.GetUser();
|
||||||
svs->to = u->nick;
|
svs->to = u->nick;
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ public:
|
|||||||
BotInfo *NickServ = Config->GetClient("NickServ");
|
BotInfo *NickServ = Config->GetClient("NickServ");
|
||||||
|
|
||||||
if (ei != NULL && NickServ != NULL)
|
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);
|
Channel *c = Channel::Find(it->first);
|
||||||
const Anope::string &cname = it->first;
|
const Anope::string &cname = it->first;
|
||||||
@@ -288,7 +288,7 @@ public:
|
|||||||
|
|
||||||
if (ei != NULL)
|
if (ei != NULL)
|
||||||
{
|
{
|
||||||
NSRecoverInfo::iterator it = ei->find(c->name);
|
auto it = ei->find(c->name);
|
||||||
if (it != ei->end())
|
if (it != ei->end())
|
||||||
{
|
{
|
||||||
for (auto mode : it->second.Modes())
|
for (auto mode : it->second.Modes())
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public:
|
|||||||
|
|
||||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
|
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);
|
this->SendSyntax(source);
|
||||||
source.Reply(" ");
|
source.Reply(" ");
|
||||||
source.Reply(_(
|
source.Reply(_(
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
|
|
||||||
Anope::string GetAgent()
|
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);
|
BotInfo *bi = Config->GetClient(agent);
|
||||||
if (bi)
|
if (bi)
|
||||||
agent = bi->GetUID();
|
agent = bi->GetUID();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
bool ProcessMessage(SASL::Session *sess, const SASL::Message &m) override
|
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")
|
if (m.type == "S")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ private:
|
|||||||
if (s->GetSerializableType()->GetName() != NICKCORE_TYPE)
|
if (s->GetSerializableType()->GetName() != NICKCORE_TYPE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const NickCore *nc = anope_dynamic_static_cast<const NickCore *>(s);
|
const auto *nc = anope_dynamic_static_cast<const NickCore *>(s);
|
||||||
Anope::string modes;
|
Anope::string modes;
|
||||||
for (const auto &[last_mode, last_data] : nc->last_modes)
|
for (const auto &[last_mode, last_data] : nc->last_modes)
|
||||||
{
|
{
|
||||||
@@ -155,7 +155,7 @@ private:
|
|||||||
if (s->GetSerializableType()->GetName() != NICKCORE_TYPE)
|
if (s->GetSerializableType()->GetName() != NICKCORE_TYPE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NickCore *nc = anope_dynamic_static_cast<NickCore *>(s);
|
auto *nc = anope_dynamic_static_cast<NickCore *>(s);
|
||||||
Anope::string modes;
|
Anope::string modes;
|
||||||
data["last_modes"] >> modes;
|
data["last_modes"] >> modes;
|
||||||
nc->last_modes.clear();
|
nc->last_modes.clear();
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
for (auto idx = reason_idx; idx < params.size(); ++idx)
|
for (auto idx = reason_idx; idx < params.size(); ++idx)
|
||||||
reason.append(reason.empty() ? "" : " ").append(params[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->what = nc->display;
|
||||||
si->by = source.GetNick();
|
si->by = source.GetNick();
|
||||||
si->reason = reason;
|
si->reason = reason;
|
||||||
@@ -199,7 +199,7 @@ public:
|
|||||||
return;
|
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");
|
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
|
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);
|
commasepstream(s).GetTokens(show);
|
||||||
std::transform(show.begin(), show.end(), show.begin(), trim());
|
std::transform(show.begin(), show.end(), show.begin(), trim());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ struct DefconConfig final
|
|||||||
|
|
||||||
bool GetDefConParam(const Anope::string &name, Anope::string &buf)
|
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();
|
buf.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct DNSZone final
|
|||||||
|
|
||||||
~DNSZone() override
|
~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())
|
if (it != zones->end())
|
||||||
zones->erase(it);
|
zones->erase(it);
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ public:
|
|||||||
|
|
||||||
~DNSServer() override
|
~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())
|
if (it != dns_servers->end())
|
||||||
dns_servers->erase(it);
|
dns_servers->erase(it);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ public:
|
|||||||
for (const auto &[_, user] : UserListByNick)
|
for (const auto &[_, user] : UserListByNick)
|
||||||
module->OnUserNickChange(user, "");
|
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;
|
NickAlias *na = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -346,7 +346,7 @@ public:
|
|||||||
{
|
{
|
||||||
int chan_matches = 0, ci_matches = 0;
|
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;
|
Channel *c = it->second;
|
||||||
++it;
|
++it;
|
||||||
@@ -369,7 +369,7 @@ public:
|
|||||||
|
|
||||||
++chan_matches;
|
++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;
|
User *u = cit->first;
|
||||||
++cit;
|
++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;
|
ChannelInfo *ci = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ OperInfoImpl::~OperInfoImpl()
|
|||||||
Extensible *e = OperInfos::Find(target);
|
Extensible *e = OperInfos::Find(target);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
OperInfos *op = e->GetExt<OperInfos>("operinfo");
|
auto *op = e->GetExt<OperInfos>("operinfo");
|
||||||
if (op)
|
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())
|
if (it != (*op)->end())
|
||||||
(*op)->erase(it);
|
(*op)->erase(it);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ Serializable *OperInfoTypeImpl::Unserialize(Serializable *obj, Serialize::Data &
|
|||||||
if (!e)
|
if (!e)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
OperInfos *oi = e->Require<OperInfos>("operinfo");
|
auto *oi = e->Require<OperInfos>("operinfo");
|
||||||
OperInfoImpl *o;
|
OperInfoImpl *o;
|
||||||
if (obj)
|
if (obj)
|
||||||
o = anope_dynamic_static_cast<OperInfoImpl *>(obj);
|
o = anope_dynamic_static_cast<OperInfoImpl *>(obj);
|
||||||
@@ -162,7 +162,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OperInfos *oi = e->Require<OperInfos>("operinfo");
|
auto *oi = e->Require<OperInfos>("operinfo");
|
||||||
|
|
||||||
if ((*oi)->size() >= Config->GetModule(this->module).Get<unsigned>("max", "10"))
|
if ((*oi)->size() >= Config->GetModule(this->module).Get<unsigned>("max", "10"))
|
||||||
{
|
{
|
||||||
@@ -195,7 +195,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OperInfos *oi = e->GetExt<OperInfos>("operinfo");
|
auto *oi = e->GetExt<OperInfos>("operinfo");
|
||||||
|
|
||||||
if (!oi)
|
if (!oi)
|
||||||
{
|
{
|
||||||
@@ -234,7 +234,7 @@ public:
|
|||||||
}
|
}
|
||||||
else if (cmd.equals_ci("CLEAR"))
|
else if (cmd.equals_ci("CLEAR"))
|
||||||
{
|
{
|
||||||
OperInfos *oi = e->GetExt<OperInfos>("operinfo");
|
auto *oi = e->GetExt<OperInfos>("operinfo");
|
||||||
|
|
||||||
if (!oi)
|
if (!oi)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public:
|
|||||||
|
|
||||||
source.Reply(_("Users list:"));
|
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;
|
User *u2 = it->second;
|
||||||
|
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ protected:
|
|||||||
source.Reply(READ_ONLY_MODE);
|
source.Reply(READ_ONLY_MODE);
|
||||||
if (!text.equals_ci("ALL"))
|
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())
|
if (num > 0 && num <= list.size())
|
||||||
{
|
{
|
||||||
OperServ::news_service->DelNewsItem(list[num - 1]);
|
OperServ::news_service->DelNewsItem(list[num - 1]);
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public:
|
|||||||
ListLimits *limits = maxlist.Get(c);
|
ListLimits *limits = maxlist.Get(c);
|
||||||
if (limits)
|
if (limits)
|
||||||
{
|
{
|
||||||
ListLimits::const_iterator limit = limits->find(cm->mchar);
|
auto limit = limits->find(cm->mchar);
|
||||||
if (limit != limits->end())
|
if (limit != limits->end())
|
||||||
return limit->second;
|
return limit->second;
|
||||||
}
|
}
|
||||||
@@ -2416,7 +2416,7 @@ struct IRCDMessageUID final
|
|||||||
|
|
||||||
NickAlias *na = NULL;
|
NickAlias *na = NULL;
|
||||||
if (SASL::service)
|
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;
|
SASLUser &u = *it;
|
||||||
|
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ namespace UnrealExtBan
|
|||||||
|
|
||||||
bool Matches(User *u, const Entry *e) override
|
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());
|
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
|
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())
|
if (moddata == NULL || moddata->find("geoip") == moddata->end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ class ModuleProxyScan final
|
|||||||
|
|
||||||
void Tick() override
|
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;
|
ProxyConnect *p = *it;
|
||||||
++it;
|
++it;
|
||||||
@@ -246,19 +246,19 @@ public:
|
|||||||
|
|
||||||
~ModuleProxyScan() override
|
~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;
|
ProxyConnect *p = *it;
|
||||||
++it;
|
++it;
|
||||||
delete p;
|
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;
|
Socket *s = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
ClientSocket *cs = dynamic_cast<ClientSocket *>(s);
|
auto *cs = dynamic_cast<ClientSocket *>(s);
|
||||||
if (cs != NULL && cs->ls == this->listener)
|
if (cs != NULL && cs->ls == this->listener)
|
||||||
delete s;
|
delete s;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -473,7 +473,7 @@ bool RedisSocket::Read(const char *buffer, size_t l)
|
|||||||
* __keyevent@0__:set
|
* __keyevent@0__:set
|
||||||
* key
|
* 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())
|
if (it != this->subinterfaces.end())
|
||||||
it->second->OnResult(r);
|
it->second->OnResult(r);
|
||||||
}
|
}
|
||||||
@@ -553,14 +553,14 @@ public:
|
|||||||
const Anope::string &n = redis.Get<const Anope::string>("name"),
|
const Anope::string &n = redis.Get<const Anope::string>("name"),
|
||||||
&ip = redis.Get<const Anope::string>("ip");
|
&ip = redis.Get<const Anope::string>("ip");
|
||||||
int port = redis.Get<int>("port");
|
int port = redis.Get<int>("port");
|
||||||
unsigned db = redis.Get<unsigned>("db");
|
auto db = redis.Get<unsigned>("db");
|
||||||
|
|
||||||
delete services[n];
|
delete services[n];
|
||||||
services[n] = new MyRedisService(this, n, ip, port, db);
|
services[n] = new MyRedisService(this, n, ip, port, db);
|
||||||
new_services.push_back(n);
|
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;
|
Provider *p = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rate limit logins to 1/sec
|
// 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)
|
if (last_login != NULL && Anope::CurTime == *last_login)
|
||||||
{
|
{
|
||||||
this->OnFail();
|
this->OnFail();
|
||||||
@@ -113,7 +113,7 @@ bool WebCPanel::Index::OnRequest(HTTP::Provider *server, const Anope::string &pa
|
|||||||
// Rate limit check.
|
// Rate limit check.
|
||||||
Anope::string ip = client->clientaddr.addr();
|
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())
|
if (it != last_login_attempt.end())
|
||||||
{
|
{
|
||||||
time_t last_time = it->second;
|
time_t last_time = it->second;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTP::Provider *server, const Anope::s
|
|||||||
}
|
}
|
||||||
if (message.post_data.count("greet") > 0)
|
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("+", " "));
|
const Anope::string &post_greet = HTTP::URLDecode(message.post_data["greet"].replace_all_cs("+", " "));
|
||||||
|
|
||||||
if (post_greet.empty())
|
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);
|
replacements["REGISTERED"] = Anope::strftime(na->nc->registered, na->nc);
|
||||||
if (na->HasVHost())
|
if (na->HasVHost())
|
||||||
replacements["VHOST"] = na->GetVHostMask();
|
replacements["VHOST"] = na->GetVHostMask();
|
||||||
Anope::string *greet = na->nc->GetExt<Anope::string>("greet");
|
auto *greet = na->nc->GetExt<Anope::string>("greet");
|
||||||
if (greet)
|
if (greet)
|
||||||
replacements["GREET"] = *greet;
|
replacements["GREET"] = *greet;
|
||||||
if (na->nc->HasExt("AUTOOP"))
|
if (na->nc->HasExt("AUTOOP"))
|
||||||
|
|||||||
@@ -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())
|
if (it != r.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
+3
-3
@@ -46,7 +46,7 @@ void PrivilegeManager::AddPrivilege(Privilege p)
|
|||||||
|
|
||||||
void PrivilegeManager::RemovePrivilege(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())
|
if (it != Privileges.end())
|
||||||
Privileges.erase(it);
|
Privileges.erase(it);
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service(o, "
|
|||||||
|
|
||||||
AccessProvider::~AccessProvider()
|
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())
|
if (it != Providers.end())
|
||||||
Providers.erase(it);
|
Providers.erase(it);
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ ChanAccess::~ChanAccess()
|
|||||||
{
|
{
|
||||||
if (this->ci)
|
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())
|
if (it != this->ci->access->end())
|
||||||
this->ci->access->erase(it);
|
this->ci->access->erase(it);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ void IdentifyRequest::Dispatch()
|
|||||||
|
|
||||||
void IdentifyRequest::ModuleUnload(Module *m)
|
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;
|
IdentifyRequest *ir = *it;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
+4
-4
@@ -111,7 +111,7 @@ BotInfo::~BotInfo()
|
|||||||
IRCD->SendSQLineDel(&x);
|
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++;
|
ChannelInfo *ci = *it++;
|
||||||
this->UnAssign(NULL, ci);
|
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 *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())
|
if (it != this->commands.end())
|
||||||
return &it->second;
|
return &it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -345,7 +345,7 @@ BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only)
|
|||||||
{
|
{
|
||||||
if (!nick_only && IRCD != NULL && IRCD->RequiresID)
|
if (!nick_only && IRCD != NULL && IRCD->RequiresID)
|
||||||
{
|
{
|
||||||
botinfo_map::iterator it = BotListByUID->find(nick);
|
auto it = BotListByUID->find(nick);
|
||||||
if (it != BotListByUID->end())
|
if (it != BotListByUID->end())
|
||||||
{
|
{
|
||||||
BotInfo *bi = it->second;
|
BotInfo *bi = it->second;
|
||||||
@@ -357,7 +357,7 @@ BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
botinfo_map::iterator it = BotListByNick->find(nick);
|
auto it = BotListByNick->find(nick);
|
||||||
if (it != BotListByNick->end())
|
if (it != BotListByNick->end())
|
||||||
{
|
{
|
||||||
BotInfo *bi = it->second;
|
BotInfo *bi = it->second;
|
||||||
|
|||||||
+9
-9
@@ -169,7 +169,7 @@ void Channel::DeleteUser(User *user)
|
|||||||
|
|
||||||
Membership *Channel::FindUser(User *u) const
|
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())
|
if (it != this->users.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -308,7 +308,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *ocm, const Mod
|
|||||||
|
|
||||||
if (cm->type == MODE_LIST)
|
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);
|
cml->OnAdd(this, mdata.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const
|
|||||||
|
|
||||||
if (cm->type == MODE_LIST)
|
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))
|
if (param.equals_ci(it->second.value))
|
||||||
{
|
{
|
||||||
this->modes.erase(it);
|
this->modes.erase(it);
|
||||||
@@ -378,7 +378,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const
|
|||||||
|
|
||||||
if (cm->type == MODE_LIST)
|
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);
|
cml->OnDel(this, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data, bool e
|
|||||||
return;
|
return;
|
||||||
else if (cm->type == MODE_PARAM)
|
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))
|
if (!cmp->IsValid(mdata.value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data, bool e
|
|||||||
}
|
}
|
||||||
else if (cm->type == MODE_LIST)
|
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))
|
if (!cml->IsValid(mdata.value))
|
||||||
return;
|
return;
|
||||||
@@ -494,7 +494,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &wpar
|
|||||||
if (cm->type == MODE_PARAM)
|
if (cm->type == MODE_PARAM)
|
||||||
{
|
{
|
||||||
param.clear();
|
param.clear();
|
||||||
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
auto *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
||||||
if (!cmp->minus_no_arg)
|
if (!cmp->minus_no_arg)
|
||||||
this->GetParam(cmp->name, param);
|
this->GetParam(cmp->name, param);
|
||||||
}
|
}
|
||||||
@@ -676,7 +676,7 @@ void Channel::SetModesInternal(MessageSource &source, const Anope::string &modes
|
|||||||
}
|
}
|
||||||
else if (cm->type == MODE_PARAM)
|
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)
|
if (!add && cmp->minus_no_arg)
|
||||||
{
|
{
|
||||||
@@ -948,7 +948,7 @@ BotInfo *Channel::WhoSends() const
|
|||||||
|
|
||||||
Channel *Channel::Find(const Anope::string &name)
|
Channel *Channel::Find(const Anope::string &name)
|
||||||
{
|
{
|
||||||
channel_map::const_iterator it = ChannelList.find(name);
|
auto it = ChannelList.find(name);
|
||||||
|
|
||||||
if (it != ChannelList.end())
|
if (it != ChannelList.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|||||||
+2
-2
@@ -235,7 +235,7 @@ namespace
|
|||||||
void HandleUnknownCommand(CommandSource& source, const Anope::string &message)
|
void HandleUnknownCommand(CommandSource& source, const Anope::string &message)
|
||||||
{
|
{
|
||||||
// Try to find a similar command.
|
// 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;
|
Anope::string similar;
|
||||||
auto umessage = message.upper();
|
auto umessage = message.upper();
|
||||||
for (const auto &[command, info] : source.service->commands)
|
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;
|
std::vector<Anope::string> params;
|
||||||
spacesepstream(message).GetTokens(params);
|
spacesepstream(message).GetTokens(params);
|
||||||
|
|
||||||
CommandInfo::map::const_iterator it = source.service->commands.end();
|
auto it = source.service->commands.end();
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
for (unsigned max = params.size(); it == source.service->commands.end() && max > 0; --max)
|
for (unsigned max = params.size(); it == source.service->commands.end() && max > 0; --max)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-5
@@ -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
|
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())
|
if (it != items.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ void Conf::Post(Conf *old)
|
|||||||
if (o->ot == NULL)
|
if (o->ot == NULL)
|
||||||
{
|
{
|
||||||
/* Oper block has lost type */
|
/* 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())
|
if (it != old->Opers.end())
|
||||||
old->Opers.erase(it);
|
old->Opers.erase(it);
|
||||||
|
|
||||||
@@ -652,7 +652,7 @@ Block &Conf::GetModule(const Module *m)
|
|||||||
|
|
||||||
Block &Conf::GetModule(const Anope::string &mname)
|
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())
|
if (it != modules.end())
|
||||||
return *it->second;
|
return *it->second;
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ Block &Conf::GetModule(const Anope::string &mname)
|
|||||||
|
|
||||||
BotInfo *Conf::GetClient(const Anope::string &cname)
|
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())
|
if (it != bots.end())
|
||||||
return BotInfo::Find(!it->second.empty() ? it->second : cname, true);
|
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 *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 = &it->second;
|
||||||
b->linenum = linenumber;
|
b->linenum = linenumber;
|
||||||
block_stack.push(b);
|
block_stack.push(b);
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ bool Extensible::HasExt(const Anope::string &name) const
|
|||||||
|
|
||||||
void Extensible::ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data)
|
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;
|
ExtensibleBase *eb = *it;
|
||||||
eb->ExtensibleSerialize(e, s, data);
|
eb->ExtensibleSerialize(e, s, data);
|
||||||
|
|||||||
+1
-1
@@ -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 */
|
/* called whenever Anope::casemap is modified to rebuild the casemap cache */
|
||||||
void Anope::CaseMapRebuild()
|
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)
|
for (unsigned i = 0; i < sizeof(case_map_upper); ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ Memo::~Memo()
|
|||||||
{
|
{
|
||||||
if (mi)
|
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())
|
if (it != mi->memos->end())
|
||||||
mi->memos->erase(it);
|
mi->memos->erase(it);
|
||||||
@@ -115,7 +115,7 @@ void MemoInfo::Del(unsigned index)
|
|||||||
|
|
||||||
Memo *m = this->GetMemo(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())
|
if (it != memos->end())
|
||||||
memos->erase(it);
|
memos->erase(it);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms,
|
|||||||
/* Special case for /join 0 */
|
/* Special case for /join 0 */
|
||||||
if (channel == "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;
|
auto *memb = it->second;
|
||||||
Channel *c = memb->chan;
|
Channel *c = memb->chan;
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ void NumberList::Process()
|
|||||||
|
|
||||||
if (this->desc)
|
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);
|
this->HandleNumber(*it);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+16
-16
@@ -206,7 +206,7 @@ ChannelModeVirtual<T>::~ChannelModeVirtual()
|
|||||||
{
|
{
|
||||||
if (basech)
|
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())
|
if (it != basech->listeners.end())
|
||||||
basech->listeners.erase(it);
|
basech->listeners.erase(it);
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ public:
|
|||||||
template<typename List, typename Object>
|
template<typename List, typename Object>
|
||||||
static StackerInfo *GetInfo(List &l, Object *o)
|
static StackerInfo *GetInfo(List &l, Object *o)
|
||||||
{
|
{
|
||||||
typename List::const_iterator it = l.find(o);
|
auto it = l.find(o);
|
||||||
if (it != l.end())
|
if (it != l.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ bool ModeManager::AddChannelMode(ChannelMode *cm)
|
|||||||
|
|
||||||
if (cm->type == MODE_STATUS)
|
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;
|
unsigned want = cms->symbol;
|
||||||
if (want >= ChannelModesIdx.size())
|
if (want >= ChannelModesIdx.size())
|
||||||
ChannelModesIdx.resize(want + 1);
|
ChannelModesIdx.resize(want + 1);
|
||||||
@@ -421,7 +421,7 @@ void ModeManager::RemoveUserMode(UserMode *um)
|
|||||||
|
|
||||||
UserModesByName.erase(um->name);
|
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())
|
if (it != UserModes.end())
|
||||||
UserModes.erase(it);
|
UserModes.erase(it);
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm)
|
|||||||
|
|
||||||
if (cm->type == MODE_STATUS)
|
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;
|
unsigned want = cms->symbol;
|
||||||
|
|
||||||
if (want >= ChannelModesIdx.size())
|
if (want >= ChannelModesIdx.size())
|
||||||
@@ -463,7 +463,7 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm)
|
|||||||
|
|
||||||
ChannelModesByName.erase(cm->name);
|
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())
|
if (it != ChannelModes.end())
|
||||||
ChannelModes.erase(it);
|
ChannelModes.erase(it);
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ UserMode *ModeManager::FindUserModeByChar(char mode)
|
|||||||
|
|
||||||
ChannelMode *ModeManager::FindChannelModeByName(const Anope::string &name)
|
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())
|
if (it != ChannelModesByName.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -498,7 +498,7 @@ ChannelMode *ModeManager::FindChannelModeByName(const Anope::string &name)
|
|||||||
|
|
||||||
UserMode *ModeManager::FindUserModeByName(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())
|
if (it != UserModesByName.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -614,7 +614,7 @@ void ModeManager::ProcessModes()
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
static void StackerDel(std::map<T *, StackerInfo *> &map, T *obj)
|
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())
|
if (it != map.end())
|
||||||
{
|
{
|
||||||
StackerInfo *si = it->second;
|
StackerInfo *si = it->second;
|
||||||
@@ -636,12 +636,12 @@ void ModeManager::StackerDel(Channel *c)
|
|||||||
|
|
||||||
void ModeManager::StackerDel(Mode *m)
|
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;
|
StackerInfo *si = it->second;
|
||||||
++it;
|
++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)
|
if (it2->first == m)
|
||||||
it2 = si->AddModes.erase(it2);
|
it2 = si->AddModes.erase(it2);
|
||||||
@@ -649,7 +649,7 @@ void ModeManager::StackerDel(Mode *m)
|
|||||||
++it2;
|
++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)
|
if (it2->first == m)
|
||||||
it2 = si->DelModes.erase(it2);
|
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;
|
StackerInfo *si = it->second;
|
||||||
++it;
|
++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)
|
if (it2->first == m)
|
||||||
it2 = si->AddModes.erase(it2);
|
it2 = si->AddModes.erase(it2);
|
||||||
@@ -671,7 +671,7 @@ void ModeManager::StackerDel(Mode *m)
|
|||||||
++it2;
|
++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)
|
if (it2->first == m)
|
||||||
it2 = si->DelModes.erase(it2);
|
it2 = si->DelModes.erase(it2);
|
||||||
@@ -804,7 +804,7 @@ bool Entry::Matches(User *u, bool full) const
|
|||||||
ChannelMode *cm = ModeManager::FindChannelModeByName(this->name);
|
ChannelMode *cm = ModeManager::FindChannelModeByName(this->name);
|
||||||
if (cm != NULL && cm->type == MODE_LIST)
|
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);
|
return cml->Matches(u, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -81,12 +81,12 @@ Module::~Module()
|
|||||||
/* Clear any active timers this module has */
|
/* Clear any active timers this module has */
|
||||||
TimerManager::DeleteTimersFor(this);
|
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())
|
if (it != ModuleManager::Modules.end())
|
||||||
ModuleManager::Modules.erase(it);
|
ModuleManager::Modules.erase(it);
|
||||||
|
|
||||||
#if HAVE_LOCALIZATION
|
#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())
|
if (dit != Language::Domains.end())
|
||||||
Language::Domains.erase(dit);
|
Language::Domains.erase(dit);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dlerror();
|
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();
|
err = dlerror();
|
||||||
if (!func)
|
if (!func)
|
||||||
{
|
{
|
||||||
@@ -233,7 +233,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
|
|||||||
ModuleVersion ModuleManager::GetVersion(void *handle)
|
ModuleVersion ModuleManager::GetVersion(void *handle)
|
||||||
{
|
{
|
||||||
dlerror();
|
dlerror();
|
||||||
ModuleVersionC (*func)() = function_cast<ModuleVersionC (*)()>(dlsym(handle, "AnopeVersion"));;
|
auto *func = function_cast<ModuleVersionC (*)()>(dlsym(handle, "AnopeVersion"));;
|
||||||
if (!func)
|
if (!func)
|
||||||
{
|
{
|
||||||
Log() << "No version function found, not an Anope module";
|
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;
|
Log(LOG_DEBUG) << "Unloading module " << m->name;
|
||||||
|
|
||||||
dlerror();
|
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();
|
const char *err = dlerror();
|
||||||
if (!destroy_func || (err && *err))
|
if (!destroy_func || (err && *err))
|
||||||
{
|
{
|
||||||
@@ -339,7 +339,7 @@ void ModuleManager::DetachAll(Module *mod)
|
|||||||
{
|
{
|
||||||
for (auto &mods : EventHandlers)
|
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())
|
if (it2 != mods.end())
|
||||||
mods.erase(it2);
|
mods.erase(it2);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -61,7 +61,7 @@ NickAlias::~NickAlias()
|
|||||||
if (this->nc)
|
if (this->nc)
|
||||||
{
|
{
|
||||||
/* Next: see if our core is still useful. */
|
/* 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())
|
if (it != this->nc->aliases->end())
|
||||||
this->nc->aliases->erase(it);
|
this->nc->aliases->erase(it);
|
||||||
if (this->nc->aliases->empty())
|
if (this->nc->aliases->empty())
|
||||||
@@ -139,7 +139,7 @@ void NickAlias::UpdateSeen(User *u)
|
|||||||
|
|
||||||
NickAlias *NickAlias::Find(const Anope::string &nick)
|
NickAlias *NickAlias::Find(const Anope::string &nick)
|
||||||
{
|
{
|
||||||
nickalias_map::const_iterator it = NickAliasList->find(nick);
|
auto it = NickAliasList->find(nick);
|
||||||
if (it != NickAliasList->end())
|
if (it != NickAliasList->end())
|
||||||
{
|
{
|
||||||
it->second->QueueUpdate();
|
it->second->QueueUpdate();
|
||||||
@@ -203,7 +203,7 @@ Serializable *NickAlias::Type::Unserialize(Serializable *obj, Serialize::Data &d
|
|||||||
|
|
||||||
if (na->nc != core)
|
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())
|
if (it != na->nc->aliases->end())
|
||||||
na->nc->aliases->erase(it);
|
na->nc->aliases->erase(it);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -50,7 +50,7 @@ NickCore::~NickCore()
|
|||||||
if (!this->chanaccess->empty())
|
if (!this->chanaccess->empty())
|
||||||
Log(LOG_DEBUG) << "Non-empty chanaccess list in destructor!";
|
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 *user = *it++;
|
||||||
user->Logout();
|
user->Logout();
|
||||||
@@ -243,7 +243,7 @@ void NickCore::GetChannelReferences(std::deque<ChannelInfo *> &queue)
|
|||||||
|
|
||||||
NickCore *NickCore::Find(const Anope::string &nick)
|
NickCore *NickCore::Find(const Anope::string &nick)
|
||||||
{
|
{
|
||||||
nickcore_map::const_iterator it = NickCoreList->find(nick);
|
auto it = NickCoreList->find(nick);
|
||||||
if (it != NickCoreList->end())
|
if (it != NickCoreList->end())
|
||||||
{
|
{
|
||||||
it->second->QueueUpdate();
|
it->second->QueueUpdate();
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o)
|
|||||||
|
|
||||||
Oper::~Oper()
|
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())
|
if (it != opers.end())
|
||||||
opers.erase(it);
|
opers.erase(it);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -466,7 +466,7 @@ int16_t ChannelInfo::GetLevel(const Anope::string &priv) const
|
|||||||
return ACCESS_INVALID;
|
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())
|
if (it == this->levels.end())
|
||||||
return 0;
|
return 0;
|
||||||
return it->second;
|
return it->second;
|
||||||
@@ -514,7 +514,7 @@ Anope::string ChannelInfo::GetIdealBan(User *u) const
|
|||||||
|
|
||||||
ChannelInfo *ChannelInfo::Find(const Anope::string &name)
|
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())
|
if (it != RegisteredChannelList->end())
|
||||||
{
|
{
|
||||||
it->second->QueueUpdate();
|
it->second->QueueUpdate();
|
||||||
|
|||||||
+1
-1
@@ -208,7 +208,7 @@ void Type::UpdateTimestamp()
|
|||||||
|
|
||||||
Type *Serialize::Type::Find(const Anope::string &name)
|
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())
|
if (it != Types.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
+1
-1
@@ -272,7 +272,7 @@ void Server::Sync(bool sync_links)
|
|||||||
FOREACH_MOD(OnPreUplinkSync, (this));
|
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;
|
Channel *c = it->second;
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void SocketEngine::Process()
|
|||||||
{
|
{
|
||||||
epoll_event &ev = events[i];
|
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())
|
if (it == Sockets.end())
|
||||||
continue;
|
continue;
|
||||||
Socket *s = it->second;
|
Socket *s = it->second;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
static void *entry_point(void *parameter)
|
static void *entry_point(void *parameter)
|
||||||
{
|
{
|
||||||
Thread *thread = static_cast<Thread *>(parameter);
|
auto *thread = static_cast<Thread *>(parameter);
|
||||||
thread->Run();
|
thread->Run();
|
||||||
thread->SetExitState();
|
thread->SetExitState();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
+3
-3
@@ -84,7 +84,7 @@ void TimerManager::AddTimer(Timer *t)
|
|||||||
void TimerManager::DelTimer(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());
|
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)
|
if (i->second == t)
|
||||||
{
|
{
|
||||||
@@ -98,7 +98,7 @@ void TimerManager::TickTimers()
|
|||||||
{
|
{
|
||||||
while (!Timers.empty())
|
while (!Timers.empty())
|
||||||
{
|
{
|
||||||
std::multimap<time_t, Timer *>::iterator it = Timers.begin();
|
auto it = Timers.begin();
|
||||||
Timer *t = it->second;
|
Timer *t = it->second;
|
||||||
|
|
||||||
if (t->GetTimer() > Anope::CurTime)
|
if (t->GetTimer() > Anope::CurTime)
|
||||||
@@ -115,7 +115,7 @@ void TimerManager::TickTimers()
|
|||||||
|
|
||||||
void TimerManager::DeleteTimersFor(Module *m)
|
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;
|
++it_next;
|
||||||
if (it->second->GetOwner() == m)
|
if (it->second->GetOwner() == m)
|
||||||
|
|||||||
+5
-5
@@ -99,7 +99,7 @@ static void CollideKill(User *target, const Anope::string &reason)
|
|||||||
IRCD->SendQuit(target, reason);
|
IRCD->SendQuit(target, reason);
|
||||||
|
|
||||||
// Reintroduce my client
|
// Reintroduce my client
|
||||||
if (BotInfo *bi = dynamic_cast<BotInfo *>(target))
|
if (auto *bi = dynamic_cast<BotInfo *>(target))
|
||||||
bi->OnKill();
|
bi->OnKill();
|
||||||
else
|
else
|
||||||
target->Quit(reason);
|
target->Quit(reason);
|
||||||
@@ -415,7 +415,7 @@ void User::Logout()
|
|||||||
|
|
||||||
Log(this, "account") << "is no longer identified as " << this->nc->display;
|
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())
|
if (it != this->nc->users.end())
|
||||||
this->nc->users.erase(it);
|
this->nc->users.erase(it);
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ const User::ModeList &User::GetModeList() const
|
|||||||
|
|
||||||
Membership *User::FindChannel(Channel *c) 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())
|
if (it != this->chans.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -854,7 +854,7 @@ User *User::Find(const Anope::string &name, bool nick_only)
|
|||||||
{
|
{
|
||||||
if (!nick_only && IRCD && IRCD->RequiresID)
|
if (!nick_only && IRCD && IRCD->RequiresID)
|
||||||
{
|
{
|
||||||
user_map::iterator it = UserListByUID.find(name);
|
auto it = UserListByUID.find(name);
|
||||||
if (it != UserListByUID.end())
|
if (it != UserListByUID.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
@@ -862,7 +862,7 @@ User *User::Find(const Anope::string &name, bool nick_only)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
user_map::iterator it = UserListByNick.find(name);
|
auto it = UserListByNick.find(name);
|
||||||
if (it != UserListByNick.end())
|
if (it != UserListByNick.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -238,7 +238,7 @@ void XLineManager::RegisterXLineManager(XLineManager *xlm)
|
|||||||
|
|
||||||
void XLineManager::UnregisterXLineManager(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())
|
if (it != XLineManagers.end())
|
||||||
XLineManagers.erase(it);
|
XLineManagers.erase(it);
|
||||||
@@ -320,11 +320,11 @@ void XLineManager::RemoveXLine(XLine *x)
|
|||||||
{
|
{
|
||||||
/* called from the destructor */
|
/* 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())
|
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)
|
for (; it2 != XLinesByUID->end() && it2 != it3; ++it2)
|
||||||
if (it2->second == x)
|
if (it2->second == x)
|
||||||
{
|
{
|
||||||
@@ -342,11 +342,11 @@ void XLineManager::RemoveXLine(XLine *x)
|
|||||||
|
|
||||||
bool XLineManager::DelXLine(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())
|
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)
|
for (; it2 != XLinesByUID->end() && it2 != it3; ++it2)
|
||||||
if (it2->second == x)
|
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)
|
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())
|
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)
|
if (it->second->manager == NULL || it->second->manager == this)
|
||||||
{
|
{
|
||||||
it->second->QueueUpdate();
|
it->second->QueueUpdate();
|
||||||
|
|||||||
Reference in New Issue
Block a user