summaryrefslogtreecommitdiff
path: root/src/modules/m_lockserv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_lockserv.cpp')
-rw-r--r--src/modules/m_lockserv.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index cc2e25308..3408e4621 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -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;
}
};