1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "commands/cmd_die.h"
16 #include "exitcodes.h"
18 extern "C" DllExport Command* init_command(InspIRCd* Instance)
20 return new CommandDie(Instance);
25 CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *user)
27 if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0].c_str(), ServerInstance->Config->powerhash))
30 std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds.";
31 ServerInstance->Logs->Log("COMMAND",SPARSE, diebuf);
32 ServerInstance->SendError(diebuf);
35 if (ServerInstance->Config->DieDelay)
36 sleep(ServerInstance->Config->DieDelay);
38 ServerInstance->Exit(EXIT_STATUS_DIE);
42 ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
43 ServerInstance->SNO->WriteGlobalSno('a', "Failed DIE Command from %s!%s@%s.",user->nick.c_str(),user->ident.c_str(),user->host.c_str());