]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_restart.cpp
Swap around ERROR and SNONOTICE in SendError() so that the server doesnt try and...
[user/henk/code/inspircd.git] / src / cmd_restart.cpp
index 1dbf5b121258fd821408d19aa3f89ca50f3f29b3..b9afd7c9db4f315e429ae2180da93b89dc279972 100644 (file)
@@ -1 +1,47 @@
-/*       +------------------------------------+\r *       | Inspire Internet Relay Chat Daemon |\r *       +------------------------------------+\r *\r *  InspIRCd: (C) 2002-2007 InspIRCd Development Team\r * See: http://www.inspircd.org/wiki/index.php/Credits\r *\r * This program is free but copyrighted software; see\r *            the file COPYING for details.\r *\r * ---------------------------------------------------\r */\r\r#include "inspircd.h"\r#include "configreader.h"\r#include "users.h"\r#include "commands/cmd_restart.h"\r\rextern "C" DllExport command_t* init_command(InspIRCd* Instance)\r{\r  return new cmd_restart(Instance);\r}\r\rCmdResult cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)\r{\r        ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);\r if (!strcmp(parameters[0],ServerInstance->Config->restartpass))\r        {\r              ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);\r\r                try\r            {\r                      ServerInstance->Restart("Server restarting.");\r         }\r              catch (...)\r            {\r                      /* We dont actually get here unless theres some fatal and unrecoverable error. */\r                      exit(0);\r               }\r      }\r      else\r   {\r              ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);\r             return CMD_FAILURE;\r    }\r\r     return CMD_SUCCESS;\r}\r\r
\ No newline at end of file
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include "inspircd.h"
+#include "commands/cmd_restart.h"
+
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
+{
+       return new cmd_restart(Instance);
+}
+
+CmdResult cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
+{
+       ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
+       if (!strcmp(parameters[0],ServerInstance->Config->restartpass))
+       {
+               ServerInstance->WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
+
+               try
+               {
+                       ServerInstance->Restart("Server restarting.");
+               }
+               catch (...)
+               {
+                       /* We dont actually get here unless theres some fatal and unrecoverable error. */
+                       exit(0);
+               }
+       }
+       else
+       {
+               ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);
+               return CMD_FAILURE;
+       }
+
+       return CMD_SUCCESS;
+}
+