From: Adam Date: Sun, 2 Oct 2016 02:15:23 +0000 (-0400) Subject: cmd_kill: deduplicate logic X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;ds=sidebyside;h=82104aa820cda85503a34223794bd429e8e26288;p=user%2Fhenk%2Fcode%2Finspircd.git cmd_kill: deduplicate logic --- diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp index 3e3a26ac7..8e8c4fadc 100644 --- a/src/coremods/core_oper/cmd_kill.cpp +++ b/src/coremods/core_oper/cmd_kill.cpp @@ -90,35 +90,23 @@ CmdResult CommandKill::Handle (const std::vector& parameters, User killreason.assign(parameters[1], 0, ServerInstance->Config->Limits.MaxQuit); } - if (!IS_LOCAL(target)) + if ((!ServerInstance->Config->HideULineKills) || (!user->server->IsULine())) { - // remote kill - if ((!ServerInstance->Config->HideULineKills) || (!user->server->IsULine())) + if (IS_LOCAL(user) && IS_LOCAL(target)) + ServerInstance->SNO->WriteGlobalSno('k', "Local kill by %s: %s (%s)", user->nick.c_str(), target->GetFullRealHost().c_str(), parameters[1].c_str()); + else ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), target->GetFullRealHost().c_str(), parameters[1].c_str()); - this->lastuuid = target->uuid; - - if (IS_LOCAL(user)) - ServerInstance->Logs->Log("KILL", LOG_DEFAULT, "REMOTE KILL: %s :%s!%s!%s (%s)", - target->nick.c_str(), - ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), - parameters[1].c_str()); } - else - { - if ((!ServerInstance->Config->HideULineKills) || (!user->server->IsULine())) - { - if (IS_LOCAL(user)) - ServerInstance->SNO->WriteGlobalSno('k', "Local kill by %s: %s (%s)", user->nick.c_str(), target->GetFullRealHost().c_str(), parameters[1].c_str()); - else - ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), target->GetFullRealHost().c_str(), parameters[1].c_str()); - } + if (IS_LOCAL(user) || IS_LOCAL(target)) ServerInstance->Logs->Log("KILL", LOG_DEFAULT, "%s KILL: %s :%s!%s!%s (%s)", - IS_LOCAL(user) ? "LOCAL" : "REMOTE", + IS_LOCAL(user) && IS_LOCAL(target) ? "LOCAL" : "REMOTE", target->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); + if (IS_LOCAL(target)) + { target->Write(":%s KILL %s :%s", ServerInstance->Config->HideKillsServer.empty() ? user->GetFullHost().c_str() : ServerInstance->Config->HideKillsServer.c_str(), target->nick.c_str(), @@ -126,6 +114,10 @@ CmdResult CommandKill::Handle (const std::vector& parameters, User this->lastuuid.clear(); } + else + { + this->lastuuid = target->uuid; + } // send the quit out ServerInstance->Users->QuitUser(target, killreason);