]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
cmd_kill: deduplicate logic
authorAdam <Adam@anope.org>
Sun, 2 Oct 2016 02:15:23 +0000 (22:15 -0400)
committerAdam <Adam@anope.org>
Wed, 12 Jul 2017 22:57:35 +0000 (18:57 -0400)
src/coremods/core_oper/cmd_kill.cpp

index 3e3a26ac770f4ad5c47590500516c4708997a2a9..8e8c4fadc5f5f08090cfda25a510ce7c03a3670c 100644 (file)
@@ -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);