From 32026e5b6f345be8bfeddde939e69eec6618fe6b Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 16 Jan 2008 08:55:18 +0000 Subject: [PATCH] Re-add support for silent quits (note: we also remove an O(n) doing it this way) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8715 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/users.h | 4 ++++ src/cull_list.cpp | 29 ++++++++++------------------- src/users.cpp | 1 + 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/users.h b/include/users.h index 9d210931c..4d7b074b6 100644 --- a/include/users.h +++ b/include/users.h @@ -620,6 +620,10 @@ class CoreExport User : public connection */ std::string operquitmsg; + /** Whether or not to send an snotice about this user's quitting + */ + bool quietquit; + /** Flood counters - lines received */ unsigned int lines_in; diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 9a3c088e8..2b769e893 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -33,15 +33,7 @@ void CullList::AddItem(User* user) void CullList::MakeSilent(User* user) { -/* for (std::vector::iterator a = list.begin(); a != list.end(); ++a) - { - if ((*a)->GetUser() == user) - { - (*a)->MakeSilent(); - break; - } - } -*/ + user->quietquit = true; return; } @@ -111,18 +103,17 @@ int CullList::Apply() { if (IS_LOCAL(u)) { - // XXX - // if (!(*a)->IsSilent()) - // { - // ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]",u->nick,u->ident,u->host,oper_reason.c_str()); - // } + if (!u->quietquit) + { + ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]",u->nick,u->ident,u->host,oper_reason.c_str()); + } } else { - // if ((!ServerInstance->SilentULine(u->server)) && (!(*a)->IsSilent())) - // { + if ((!ServerInstance->SilentULine(u->server)) && (!u->quietquit)) + { ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]",u->server,u->nick,u->ident,u->host,oper_reason.c_str()); - // } + } } u->AddToWhoWas(); } @@ -136,13 +127,13 @@ int CullList::Apply() ServerInstance->local_users.erase(x); } ServerInstance->clientlist->erase(iter); - delete u; } - // delete *list.begin(); + delete u; list.erase(list.begin()); exempt.erase(exemptiter); } + return n; } diff --git a/src/users.cpp b/src/users.cpp index 1d2b16dee..f2c2d9ae4 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -709,6 +709,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->quietquit = false; user->quitmsg = quitreason; user->operquitmsg = operreason; Instance->GlobalCulls.AddItem(user); -- 2.39.2