summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-10-01 22:15:23 -0400
committerAdam <Adam@anope.org>2017-07-12 18:57:35 -0400
commit82104aa820cda85503a34223794bd429e8e26288 (patch)
treeeeee50ba63ea0038d1ef9b66709fff2ef029e369 /src
parent1f3b7f2455b0d73d8874daff0459f4bde46b9524 (diff)
cmd_kill: deduplicate logic
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_oper/cmd_kill.cpp32
1 files changed, 12 insertions, 20 deletions
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<std::string>& 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<std::string>& parameters, User
this->lastuuid.clear();
}
+ else
+ {
+ this->lastuuid = target->uuid;
+ }
// send the quit out
ServerInstance->Users->QuitUser(target, killreason);