summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-07 13:07:32 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-07 13:07:32 +0200
commit4d7c590bb6a937c4c412241ae67b9fc74083b365 (patch)
tree7256a6e6895fa473218f8793e9f3f127a5008594
parent9a8970fd0f33af44515863b28625cc4fae4c73a7 (diff)
m_channames Remove temporary vector from ValidateChans()
-rw-r--r--src/modules/m_channames.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index be9eda2b9..5a38fbbc2 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -65,17 +65,15 @@ class ModuleChannelNames : public Module
void ValidateChans()
{
badchan = true;
- std::vector<Channel*> chanvec;
const chan_hash& chans = ServerInstance->GetChans();
- for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ++i)
+ for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); )
{
- if (!ServerInstance->IsChannel(i->second->name))
- chanvec.push_back(i->second);
- }
- std::vector<Channel*>::reverse_iterator c2 = chanvec.rbegin();
- while (c2 != chanvec.rend())
- {
- Channel* c = *c2++;
+ Channel* c = i->second;
+ // Move iterator before we begin kicking
+ ++i;
+ if (ServerInstance->IsChannel(c->name))
+ continue; // The name of this channel is still valid
+
if (c->IsModeSet(permchannelmode) && c->GetUserCounter())
{
std::vector<std::string> modes;