cmd_restart.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "inspircd.h"
00015 #include "configreader.h"
00016 #include "users.h"
00017 #include "commands/cmd_restart.h"
00018
00019 extern "C" DllExport command_t* init_command(InspIRCd* Instance)
00020 {
00021 return new cmd_restart(Instance);
00022 }
00023
00024 CmdResult cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
00025 {
00026 ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
00027 if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
00028 {
00029 ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
00030
00031 try
00032 {
00033 ServerInstance->Restart("Server restarting.");
00034 }
00035 catch (...)
00036 {
00037
00038 exit(0);
00039 }
00040 }
00041 else
00042 {
00043 ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);
00044 return CMD_FAILURE;
00045 }
00046
00047 return CMD_SUCCESS;
00048 }
00049