]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_kill.cpp
Add sanity checks to the ssl modules so that theres no possibility of an out of range...
[user/henk/code/inspircd.git] / src / cmd_kill.cpp
index 26f354b8f2bf3e654b8ed21e557f0bb02afc8106..43cf1d5ab2d393d621c5cef7176a8d05d79759cc 100644 (file)
  */
 
 #include "inspircd.h"
-#include "configreader.h"
-#include "users.h"
-#include "modules.h"
-#include "wildcard.h"
 #include "commands/cmd_kill.h"
 
 extern "C" DllExport command_t* init_command(InspIRCd* Instance)
@@ -33,7 +29,6 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
 
        userrec *u = ServerInstance->FindNick(parameters[0]);
        char killreason[MAXBUF];
-       char killoperreason[MAXBUF];
        int MOD_RESULT = 0;
 
        if (u)
@@ -66,18 +61,11 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
                                // hidekills is off, do nothing
                                snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]);
                        }
-
-                       // opers are lucky ducks, they always see the real reason
-                       snprintf(killoperreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]);
                }
                else
                {
+                       /* Leave it alone, remote server has already formatted it */
                        snprintf(killreason, MAXQUIT, "%s", parameters[1]);
-                       /*
-                        * XXX - yes, this means opers will probably see a censored kill remotely. this needs fixing.
-                        * maybe a version of QuitUser that doesn't take nor propegate an oper reason? -- w00t
-                        */
-                       snprintf(killoperreason, MAXQUIT, "%s", parameters[1]);
                }
 
                /*
@@ -88,7 +76,7 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
                {
                        // remote kill
                        ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
-                       FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killoperreason));
+                       FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason));
                }
                else
                {
@@ -99,12 +87,23 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
                         */
                        ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
                        ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
-                       user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost,
-                                       *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->nick, parameters[1]);
+                       /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
+                        * hidekillsserver as source if possible
+                        */
+                       if (!u->muted)
+                       {
+                               u->Write(":%s KILL %s :%s!%s!%s (%s)", *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->GetFullHost(),
+                                               u->nick,
+                                               ServerInstance->Config->ServerName,
+                                               user->dhost,
+                                               *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->nick,
+                                               parameters[1]);
+                               u->muted = true;
+                       }
                }
 
                // send the quit out
-               userrec::QuitUser(ServerInstance, u, killreason, killoperreason);
+               userrec::QuitUser(ServerInstance, u, killreason);
        }
        else
        {