1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
20 #include "configreader.h"
24 #include "commands/cmd_die.h"
28 void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
30 if (!strcmp(parameters[0],ServerInstance->Config->diepass))
32 ServerInstance->Log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, ServerInstance->Config->DieDelay);
34 /* This would just be WriteOpers(), but as we just sleep() and then die then the write buffers never get flushed.
35 * so we iterate the oper list, writing the message and immediately trying to flush their write buffer.
38 for (std::vector<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++)
42 if (IS_LOCAL(a) && (a->modes[UM_SERVERNOTICE]))
44 a->WriteServ("NOTICE %s :*** DIE command from %s!%s@%s, terminating...", a->nick, a->nick, a->ident, a->host);
49 sleep(ServerInstance->Config->DieDelay);
50 InspIRCd::Exit(ERROR);
54 ServerInstance->Log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
55 ServerInstance->WriteOpers("*** Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);