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 * ---------------------------------------------------
14 #include "configreader.h"
16 #include "commands/cmd_die.h"
18 extern "C" command_t* init_command(InspIRCd* Instance)
20 return new cmd_die(Instance);
25 CmdResult cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
27 if (!strcmp(parameters[0],ServerInstance->Config->diepass))
29 ServerInstance->Log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, ServerInstance->Config->DieDelay);
31 /* This would just be WriteOpers(), but as we just sleep() and then die then the write buffers never get flushed.
32 * so we iterate the oper list, writing the message and immediately trying to flush their write buffer.
35 for (std::vector<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++)
39 if (IS_LOCAL(a) && (a->modes[UM_SERVERNOTICE]))
41 a->WriteServ("NOTICE %s :*** DIE command from %s!%s@%s, terminating...", a->nick, a->nick, a->ident, a->host);
46 sleep(ServerInstance->Config->DieDelay);
47 InspIRCd::Exit(ERROR);
51 ServerInstance->Log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
52 ServerInstance->WriteOpers("*** Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);