diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-07-05 02:32:36 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-07-07 15:57:35 +0200 |
commit | 1fe23633b78b836f6c906b651255c1bd169f3778 (patch) | |
tree | 523816343e0fb30d30df26eba3ab2fe5d3f791a8 /src/modules | |
parent | 933fdb87ea674ac30a4a970d2ed095c220c9ebcd (diff) |
m_lockserv Don't lock/unlock when already locked/unlocked, update messages
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_lockserv.cpp | 16 |
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> ¶meters, 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> ¶meters, 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; } }; |