1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 04:23:13 +02:00

Change Channel::GetModeList to return a copy of the mode list, not a

pair of lower/upper bound iterators.

Sometimes when iterating the list, like in cs_mode, we can modify the
contents of it, which combined with mlock always agressively trying to
readd modes to it can do bad things.
This commit is contained in:
Adam
2014-08-24 16:39:04 -04:00
parent d417241a5b
commit bf8f62c32d
7 changed files with 49 additions and 49 deletions
+9 -9
View File
@@ -155,21 +155,21 @@ class MyXMLRPCEvent : public XMLRPCEvent
{
request.reply("bancount", stringify(c->HasMode("BAN")));
int count = 0;
std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = c->GetModeList("BAN");
for (; its.first != its.second; ++its.first)
request.reply("ban" + stringify(++count), iface->Sanitize(its.first->second));
std::vector<Anope::string> v = c->GetModeList("BAN");
for (unsigned int i = 0; i < v.size(); ++i)
request.reply("ban" + stringify(++count), iface->Sanitize(v[i]));
request.reply("exceptcount", stringify(c->HasMode("EXCEPT")));
count = 0;
its = c->GetModeList("EXCEPT");
for (; its.first != its.second; ++its.first)
request.reply("except" + stringify(++count), iface->Sanitize(its.first->second));
v = c->GetModeList("EXCEPT");
for (unsigned int i = 0; i < v.size(); ++i)
request.reply("except" + stringify(++count), iface->Sanitize(v[i]));
request.reply("invitecount", stringify(c->HasMode("INVITEOVERRIDE")));
count = 0;
its = c->GetModeList("INVITEOVERRIDE");
for (; its.first != its.second; ++its.first)
request.reply("invite" + stringify(++count), iface->Sanitize(its.first->second));
v = c->GetModeList("INVITEOVERRIDE");
for (unsigned int i = 0; i < v.size(); ++i)
request.reply("invite" + stringify(++count), iface->Sanitize(v[i]));
Anope::string users;
for (Channel::ChanUserList::const_iterator it = c->users.begin(); it != c->users.end(); ++it)