1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "configreader.h"
19 #include "commands/cmd_kill.h"
21 extern "C" DllExport command_t* init_command(InspIRCd* Instance)
23 return new cmd_kill(Instance);
28 CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
30 /* Allow comma seperated lists of users for /KILL (thanks w00t) */
31 if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
34 userrec *u = ServerInstance->FindNick(parameters[0]);
35 char killreason[MAXBUF];
36 char killoperreason[MAXBUF];
42 * Here, we need to decide how to munge kill messages. Whether to hide killer, what to show opers, etc.
43 * We only do this when the command is being issued LOCALLY, for remote KILL, we just copy the message we got.
45 * This conditional is so that we only append the "Killed (" prefix ONCE. If killer is remote, then the kill
46 * just gets processed and passed on, otherwise, if they are local, it gets prefixed. Makes sense :-) -- w00t
51 * Moved this event inside the IS_LOCAL check also, we don't want half the network killing a user
52 * and the other half not. This would be a bad thing. ;p -- w00t
54 FOREACH_RESULT(I_OnKill, OnKill(user, u, parameters[1]));
59 if (*ServerInstance->Config->HideKillsServer)
61 // hidekills is on, use it
62 snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1]);
66 // hidekills is off, do nothing
67 snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]);
70 // opers are lucky ducks, they always see the real reason
71 snprintf(killoperreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]);
75 snprintf(killreason, MAXQUIT, "%s", parameters[1]);
77 * XXX - yes, this means opers will probably see a censored kill remotely. this needs fixing.
78 * maybe a version of QuitUser that doesn't take nor propegate an oper reason? -- w00t
80 snprintf(killoperreason, MAXQUIT, "%s", parameters[1]);
84 * Now we need to decide whether or not to send a local or remote snotice. Currently this checking is a little flawed.
85 * No time to fix it right now, so left a note. -- w00t
90 ServerInstance->SNO->WriteToSnoMask('k',"Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
91 FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason));
97 * XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill
98 * snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
100 ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
101 ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
102 user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", *ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : u->nick,
103 ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
107 userrec::QuitUser(ServerInstance, u, killreason, killoperreason);
111 user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0]);