summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-08-24 16:39:04 -0400
committerAdam <Adam@anope.org>2014-08-24 16:39:04 -0400
commitbf8f62c32d6c66e38c167e6ca0ac59d29db52326 (patch)
treeffdd06b244fcd38eca5956c7f9143f76ddcaaf5e /modules/commands
parentd417241a5b87e1e717755aa851ba0977857db873 (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/commands')
-rw-r--r--modules/commands/cs_akick.cpp6
-rw-r--r--modules/commands/cs_mode.cpp13
2 files changed, 7 insertions, 12 deletions
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 873b1cb43..1fac25335 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -71,10 +71,10 @@ class CommandCSAKick : public Command
/* Check excepts BEFORE we get this far */
if (ci->c)
{
- std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = ci->c->GetModeList("EXCEPT");
- for (; modes.first != modes.second; ++modes.first)
+ std::vector<Anope::string> modes = ci->c->GetModeList("EXCEPT");
+ for (unsigned int i = 0; i < modes.size(); ++i)
{
- if (Anope::Match(modes.first->second, mask))
+ if (Anope::Match(modes[i], mask))
{
source.Reply(CHAN_EXCEPTED, mask.c_str(), ci->name.c_str());
return;
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp
index 7f22d1e26..d5c356fa4 100644
--- a/modules/commands/cs_mode.cpp
+++ b/modules/commands/cs_mode.cpp
@@ -615,15 +615,10 @@ class CommandCSMode : public Command
}
else
{
- std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = ci->c->GetModeList(cm->name);
- for (; its.first != its.second;)
- {
- const Anope::string &mask = its.first->second;
- ++its.first;
-
- if (Anope::Match(mask, param))
- ci->c->RemoveMode(NULL, cm, mask);
- }
+ std::vector<Anope::string> v = ci->c->GetModeList(cm->name);
+ for (unsigned j = 0; j < v.size(); ++j)
+ if (Anope::Match(v[j], param))
+ ci->c->RemoveMode(NULL, cm, v[j]);
}
}
}