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 * ---------------------------------------------------
19 #include "inspircd_config.h"
21 #include "inspircd_io.h"
30 #include "inspstring.h"
31 #include "helperfuncs.h"
36 extern ServerConfig* Config;
37 extern std::vector<userrec*> all_opers;
39 void cmd_die::Handle (char **parameters, int pcnt, userrec *user)
41 if (!strcmp(parameters[0],Config->diepass))
43 log(SPARSE, "/DIE command from %s!%s@%s, terminating in %d seconds...", user->nick, user->ident, user->host, Config->DieDelay);
45 /* This would just be WriteOpers(), but as we just sleep() and then die then the write buffers never get flushed.
46 * so we iterate the oper list, writing the message and immediately trying to flush their write buffer.
49 for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++)
53 if (IS_LOCAL(a) && (a->modebits & UM_SERVERNOTICE))
55 WriteServ(a->fd, "NOTICE %s :*** DIE command from %s!%s@%s, terminating...", a->nick, a->nick, a->ident, a->host);
60 sleep(Config->DieDelay);
65 log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
66 WriteOpers("*** Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);