From af9d3617375b3fb013dc6ac49a1926bde4f775e0 Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 16 Jan 2008 16:19:57 +0000 Subject: Remove an O(log n) in favour of an O(1) operation, and tidy up culllist some more git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8717 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands/cmd_kill.cpp | 2 +- src/cull_list.cpp | 12 ++++-------- src/users.cpp | 6 +++--- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 675532a3c..6a1e64d7f 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -90,7 +90,7 @@ CmdResult CommandKill::Handle (const char** parameters, int pcnt, User *user) /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show * hidekillsserver as source if possible */ - if (!u->muted) + if (!u->quitting) { u->Write(":%s KILL %s :%s!%s!%s (%s)", *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->GetFullHost(), u->nick, diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 2b769e893..365cca231 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -19,16 +19,14 @@ CullList::CullList(InspIRCd* Instance) : ServerInstance(Instance) { list.clear(); - exempt.clear(); } void CullList::AddItem(User* user) { - if (exempt.find(user) == exempt.end()) - { - list.push_back(user); - exempt[user] = user; - } + if (user->quitting) + return; + + list.push_back(user); } void CullList::MakeSilent(User* user) @@ -48,7 +46,6 @@ int CullList::Apply() User *u = (*a); user_hash::iterator iter = ServerInstance->clientlist->find(u->nick); - std::map::iterator exemptiter = exempt.find(u); const char* preset_reason = u->GetOperQuit(); std::string reason = u->operquitmsg; std::string oper_reason = *preset_reason ? preset_reason : u->operquitmsg; @@ -131,7 +128,6 @@ int CullList::Apply() delete u; list.erase(list.begin()); - exempt.erase(exemptiter); } return n; diff --git a/src/users.cpp b/src/users.cpp index 538f8d33b..5f37d08bb 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -181,7 +181,7 @@ User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance Penalty = 0; lines_in = lastping = signon = idle_lastmsg = nping = registered = 0; ChannelCount = timeout = bytes_in = bytes_out = cmds_in = cmds_out = 0; - OverPenalty = ExemptFromPenalty = muted = exempt = haspassed = dns_done = false; + OverPenalty = ExemptFromPenalty = quitting = exempt = haspassed = dns_done = false; fd = -1; recvq.clear(); sendq.clear(); @@ -708,7 +708,7 @@ void User::QuitUser(InspIRCd* Instance, User *user, const std::string &quitreaso { Instance->Log(DEBUG,"QuitUser: %s '%s'", user->nick, quitreason.c_str()); user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, *operreason ? operreason : quitreason.c_str()); - user->muted = true; + user->quitting = true; user->quietquit = false; user->quitmsg = quitreason; user->operquitmsg = operreason; @@ -1700,7 +1700,7 @@ void User::ShowRULES() void User::HandleEvent(EventType et, int errornum) { - if (this->muted) // drop everything, user is due to be quit + if (this->quitting) // drop everything, user is due to be quit return; /* WARNING: May delete this user! */ -- cgit v1.2.3