]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_oper/cmd_die.cpp
core_user Deduplicate code that calls the OnUserRegister hook
[user/henk/code/inspircd.git] / src / coremods / core_oper / cmd_die.cpp
index 63e4c596a82a47b11f40108e1f1c1493e43075c7..5a9415915e89aa83025e7988149295b0bdf7f52d 100644 (file)
 
 
 #include "inspircd.h"
+#include "exitcodes.h"
+#include "core_oper.h"
 
-/** Handle /DIE.
- */
-class CommandDie : public Command
+CommandDie::CommandDie(Module* parent)
+       : Command(parent, "DIE", 1)
 {
- public:
-       /** Constructor for die.
-        */
-       CommandDie ( Module* parent) : Command(parent,"DIE",1) { flags_needed = 'o'; syntax = "<password>"; }
-       /** Handle command.
-        * @param parameters The parameters to the command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#include "exitcodes.h"
+       flags_needed = 'o';
+       syntax = "<password>";
+}
 
 /** Handle /DIE
  */
 CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *user)
 {
-       if (ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash))
+       if (DieRestart::CheckPass(user, parameters[0], "diepass"))
        {
                {
                        std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating.";
@@ -60,5 +51,3 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *
        }
        return CMD_SUCCESS;
 }
-
-COMMAND_INIT(CommandDie)