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" 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];
40 FOREACH_RESULT(I_OnKill, OnKill(user, u, parameters[1]));
48 ServerInstance->SNO->WriteToSnoMask('k',"Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
49 snprintf(killreason, MAXQUIT,"[%s] Killed (%s (%s))", ServerInstance->Config->ServerName, user->nick, parameters[1]);
50 u->WriteCommonExcept("QUIT :%s", killreason);
51 FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason));
53 user_hash::iterator iter = ServerInstance->clientlist->find(u->nick);
55 if (iter != ServerInstance->clientlist->end())
56 ServerInstance->clientlist->erase(iter);
58 if (u->registered == REG_ALL)
60 u->PurgeEmptyChannels();
65 std::string original_command = std::string("KILL ") + u->nick + " :"+parameters[1];
66 FOREACH_MOD(I_OnPostCommand,OnPostCommand("KILL", parameters, pcnt, user, CMD_SUCCESS,original_command));
67 return CMD_USER_DELETED;
74 ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
75 user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
76 ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
77 snprintf(killreason,MAXQUIT,"Killed (%s (%s))", user->nick, parameters[1]);
78 userrec::QuitUser(ServerInstance, u, killreason);
81 return CMD_USER_DELETED;
86 user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0]);