From 1662f21eedf91c49ac97333f72f494c36895803e Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:50:21 +0000 Subject: Remove now-unused quitmsg/operquitmsg fields from User git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11637 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/users.h | 18 ------------------ src/commands/cmd_quit.cpp | 11 ++++++++++- src/modules/m_spanningtree/main.cpp | 4 ++-- src/modules/m_spanningtree/operquit.cpp | 2 +- src/modules/m_spanningtree/treeserver.cpp | 6 +++--- src/usermanager.cpp | 19 +++++-------------- src/users.cpp | 10 ---------- 7 files changed, 21 insertions(+), 49 deletions(-) diff --git a/include/users.h b/include/users.h index 19d78ec23..14f98f701 100644 --- a/include/users.h +++ b/include/users.h @@ -457,14 +457,6 @@ class CoreExport User : public EventHandler */ std::string sendq; - /** Message user will quit with. Not to be set externally. - */ - std::string quitmsg; - - /** Quit message shown to opers - not to be set externally. - */ - std::string operquitmsg; - /** Whether or not to send an snotice about this user's quitting */ bool quietquit; @@ -952,16 +944,6 @@ class CoreExport User : public EventHandler */ void ShowRULES(); - /** Set oper-specific quit message shown to opers only when the user quits - * (overrides any sent by QuitUser) - */ - void SetOperQuit(const std::string &oquit); - - /** Get oper-specific quit message shown only to opers when the user quits. - * (overrides any sent by QuitUser) - */ - const std::string& GetOperQuit(); - /** Increases a user's command penalty by a set amount. */ void IncreasePenalty(int increase); diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp index 9c0392162..e29382e84 100644 --- a/src/commands/cmd_quit.cpp +++ b/src/commands/cmd_quit.cpp @@ -38,7 +38,16 @@ CmdResult CommandQuit::Handle (const std::vector& parameters, User else quitmsg = parameters.size() ? parameters[0] : "Client exited"; - ServerInstance->Users->QuitUser(user, quitmsg); + std::string* operquit; + if (user->GetExt("operquit", operquit)) + { + ServerInstance->Users->QuitUser(user, quitmsg, operquit->c_str()); + delete operquit; + } + else + { + ServerInstance->Users->QuitUser(user, quitmsg); + } return CMD_SUCCESS; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 3e2b5d3b5..ed0165c0e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -711,13 +711,13 @@ void ModuleSpanningTree::OnRemoteKill(User* source, User* dest, const std::strin if (!IS_LOCAL(source)) return; // Only start routing if we're origin. + dest->Extend("operquit", new std::string(operreason)); parameterlist params; - params.push_back(":"+reason); + params.push_back(":"+operreason); Utils->DoOneToMany(dest->uuid,"OPERQUIT",params); params.clear(); params.push_back(dest->uuid); params.push_back(":"+reason); - dest->SetOperQuit(operreason); Utils->DoOneToMany(source->uuid,"KILL",params); } diff --git a/src/modules/m_spanningtree/operquit.cpp b/src/modules/m_spanningtree/operquit.cpp index a71f73da7..5260cd990 100644 --- a/src/modules/m_spanningtree/operquit.cpp +++ b/src/modules/m_spanningtree/operquit.cpp @@ -30,7 +30,7 @@ bool TreeSocket::OperQuit(const std::string &prefix, parameterlist ¶ms) if (u) { - u->SetOperQuit(params[0]); + u->Extend("operquit", new std::string(params[0])); params[0] = ":" + params[0]; Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix); } diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 6c8c6a33c..c9f4cfdfa 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -176,13 +176,13 @@ int TreeServer::QuitUsers(const std::string &reason) User* a = (User*)*n; if (!IS_LOCAL(a)) { + if (this->Utils->quiet_bursts) + a->quietquit = true; + if (ServerInstance->Config->HideSplits) ServerInstance->Users->QuitUser(a, "*.net *.split", reason_s); else ServerInstance->Users->QuitUser(a, reason_s); - - if (this->Utils->quiet_bursts) - a->quietquit = true; } } return time_to_die.size(); diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 31ffad007..adec2fe16 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -176,22 +176,13 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char ServerInstance->Logs->Log("USERS", DEBUG, "QuitUser: %s '%s'", user->nick.c_str(), quitreason.c_str()); user->Write("ERROR :Closing link: (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str()); - user->quietquit = false; - user->quitmsg = quitreason; - std::string reason; std::string oper_reason; reason.assign(quitreason, 0, ServerInstance->Config->Limits.MaxQuit); - if (!*operreason) - { - user->operquitmsg = quitreason; - oper_reason.assign(quitreason, 0, ServerInstance->Config->Limits.MaxQuit); - } - else - { - user->operquitmsg = operreason; + if (operreason && *operreason) oper_reason.assign(operreason, 0, ServerInstance->Config->Limits.MaxQuit); - } + else + oper_reason = quitreason; ServerInstance->GlobalCulls.AddItem(user); @@ -244,7 +235,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if (!user->quietquit) { ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]", - user->nick.c_str(), user->ident.c_str(), user->host.c_str(), user->operquitmsg.c_str()); + user->nick.c_str(), user->ident.c_str(), user->host.c_str(), oper_reason.c_str()); } } else @@ -252,7 +243,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if ((!ServerInstance->SilentULine(user->server)) && (!user->quietquit)) { ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]", - user->server, user->nick.c_str(), user->ident.c_str(), user->host.c_str(), user->operquitmsg.c_str()); + user->server, user->nick.c_str(), user->ident.c_str(), user->host.c_str(), oper_reason.c_str()); } } user->AddToWhoWas(); diff --git a/src/users.cpp b/src/users.cpp index 35aa2cd30..dfff7f034 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1926,16 +1926,6 @@ void User::HandleEvent(EventType et, int errornum) } } -void User::SetOperQuit(const std::string &oquit) -{ - operquitmsg = oquit; -} - -const std::string& User::GetOperQuit() -{ - return operquitmsg; -} - void User::IncreasePenalty(int increase) { this->Penalty += increase; -- cgit v1.2.3