diff options
author | Adam <Adam@anope.org> | 2012-11-07 15:41:49 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-07 15:41:49 -0500 |
commit | 8b78b6bb104e8c1088d066f153967678b50a15a8 (patch) | |
tree | accc740a620890bdbbd519d1e4b354af4577492f /modules/commands/cs_clearusers.cpp | |
parent | 52fa66820c5166f30da65db14986483cdb6cd916 (diff) |
Fix crash on suspend etc if kicking a user causes the service bot to part when the service bot is next in the userlist (as we have an iterator to it)
Diffstat (limited to 'modules/commands/cs_clearusers.cpp')
-rw-r--r-- | modules/commands/cs_clearusers.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/commands/cs_clearusers.cpp b/modules/commands/cs_clearusers.cpp index 9a50f70c9..d6eed6e4d 100644 --- a/modules/commands/cs_clearusers.cpp +++ b/modules/commands/cs_clearusers.cpp @@ -47,13 +47,17 @@ class CommandCSClearUsers : public Command Anope::string buf = "CLEARUSERS command from " + source.GetNick() + " (" + source.nc->display + ")"; - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) + std::vector<User *> users; + for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it) { - UserContainer *uc = *it++; - - c->Kick(NULL, uc->user, "%s", buf.c_str()); + User *user = (*it)->user; + if (!user->HasMode(UMODE_OPER) && user->server != Me) + users.push_back(user); } + for (unsigned i = 0; i < users.size(); ++i) + c->Kick(NULL, users[i], "%s", buf.c_str()); + bool override = !source.AccessFor(c->ci).HasPriv("FOUNDER"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci); |