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 * ---------------------------------------------------
18 class CommandRestart : public Command
21 /** Constructor for restart.
23 CommandRestart(Module* parent) : Command(parent,"RESTART",1,1) { flags_needed = 'o'; syntax = "<password>"; }
25 * @param parameters The parameters to the comamnd
26 * @param pcnt The number of parameters passed to teh command
27 * @param user The user issuing the command
28 * @return A value from CmdResult to indicate command success or failure.
30 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
33 CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user)
35 ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick.c_str());
36 if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash))
38 ServerInstance->SNO->WriteGlobalSno('a', "RESTART command from %s!%s@%s, restarting server.", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
42 ServerInstance->Restart("Server restarting.");
46 /* We dont actually get here unless theres some fatal and unrecoverable error. */
52 ServerInstance->SNO->WriteGlobalSno('a', "Failed RESTART Command from %s!%s@%s.", user->nick.c_str(), user->ident.c_str(), user->host.c_str());
60 COMMAND_INIT(CommandRestart)