summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-07-05 02:32:36 +0200
committerattilamolnar <attilamolnar@hush.com>2012-07-07 15:57:35 +0200
commit1fe23633b78b836f6c906b651255c1bd169f3778 (patch)
tree523816343e0fb30d30df26eba3ab2fe5d3f791a8
parent933fdb87ea674ac30a4a970d2ed095c220c9ebcd (diff)
m_lockserv Don't lock/unlock when already locked/unlocked, update messages
-rw-r--r--src/modules/m_lockserv.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index dc71101a8..3408e4621 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -39,9 +39,15 @@ public:
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());
+ ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily disallow new connections", user->nick.c_str());
return CMD_SUCCESS;
}
};
@@ -59,9 +65,15 @@ public:
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());
+ ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow new connections", user->nick.c_str());
return CMD_SUCCESS;
}
};