]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_lockserv.cpp
m_namesx, m_uhnames Don't convert the command name to irc::string in OnPreCommand()
[user/henk/code/inspircd.git] / src / modules / m_lockserv.cpp
index cc2e253081999d596eb151be0df82e9b2e464e60..3408e4621f278d630d859a2dcc7289588f3de3ac 100644 (file)
@@ -34,15 +34,20 @@ class CommandLockserv : public Command
 public:
        CommandLockserv(Module* Creator, bool& lock) : Command(Creator, "LOCKSERV", 0), locked(lock)
        {
-               flags_needed = 'o'; syntax.clear();
+               flags_needed = 'o';
        }
 
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
+               if (locked)
+               {
+                       user->WriteServ("NOTICE %s :The server is already locked.", user->nick.c_str());
+                       return CMD_FAILURE;
+               }
+
                locked = true;
                user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick.c_str(), user->server.c_str());
-               ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily close for new connections", user->nick.c_str());
-               /* Dont send to the network */
+               ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily disallow new connections", user->nick.c_str());
                return CMD_SUCCESS;
        }
 };
@@ -55,15 +60,20 @@ private:
 public:
        CommandUnlockserv(Module* Creator, bool &lock) : Command(Creator, "UNLOCKSERV", 0), locked(lock)
        {
-               flags_needed = 'o'; syntax.clear();
+               flags_needed = 'o';
        }
 
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
+               if (!locked)
+               {
+                       user->WriteServ("NOTICE %s :The server isn't locked.", user->nick.c_str());
+                       return CMD_FAILURE;
+               }
+
                locked = false;
                user->WriteNumeric(989, "%s %s :Open for new connections", user->nick.c_str(), user->server.c_str());
-               ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow for new connections", user->nick.c_str());
-               /* Dont send to the network */
+               ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow new connections", user->nick.c_str());
                return CMD_SUCCESS;
        }
 };