diff options
author | Adam <Adam@anope.org> | 2014-08-24 16:39:04 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-08-24 16:39:04 -0400 |
commit | bf8f62c32d6c66e38c167e6ca0ac59d29db52326 (patch) | |
tree | ffdd06b244fcd38eca5956c7f9143f76ddcaaf5e /modules/m_xmlrpc_main.cpp | |
parent | d417241a5b87e1e717755aa851ba0977857db873 (diff) |
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.
Diffstat (limited to 'modules/m_xmlrpc_main.cpp')
-rw-r--r-- | modules/m_xmlrpc_main.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/m_xmlrpc_main.cpp b/modules/m_xmlrpc_main.cpp index 1a496c65c..13645bc98 100644 --- a/modules/m_xmlrpc_main.cpp +++ b/modules/m_xmlrpc_main.cpp @@ -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) |