X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_lockserv.cpp;h=b50ca24c0030455ba1c8256e39ebd14429c5d138;hb=HEAD;hp=7c1bb5bd35c902639907aa9f41a8ee4533115b15;hpb=c0aba5b728b0a921d95ec120aa638dab1520b42f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 7c1bb5bd3..b50ca24c0 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -1,8 +1,13 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2013, 2016-2018 Sadie Powell + * Copyright (C) 2012-2013 Attila Molnar + * Copyright (C) 2012, 2019 Robby + * Copyright (C) 2010 Craig Edwards + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2007-2008 Robin Burchell * Copyright (C) 2006-2007 Dennis Friis - * Copyright (C) 2007 Robin Burchell * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -24,6 +29,12 @@ * 988 :Closed for new connections * 989 :Open for new connections */ +enum +{ + // InspIRCd-specific. + RPL_SERVLOCKON = 988, + RPL_SERVLOCKOFF = 989 +}; class CommandLockserv : public Command { @@ -36,7 +47,7 @@ class CommandLockserv : public Command flags_needed = 'o'; } - CmdResult Handle (const std::vector ¶meters, User *user) + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE { if (!locked.empty()) { @@ -45,7 +56,7 @@ class CommandLockserv : public Command } locked = parameters.empty() ? "Server is temporarily closed. Please try again later." : parameters[0]; - user->WriteNumeric(988, user->server->GetName(), "Closed for new connections"); + user->WriteNumeric(RPL_SERVLOCKON, user->server->GetName(), "Closed for new connections"); ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily disallow new connections", user->nick.c_str()); return CMD_SUCCESS; } @@ -61,7 +72,7 @@ class CommandUnlockserv : public Command flags_needed = 'o'; } - CmdResult Handle (const std::vector ¶meters, User *user) + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE { if (locked.empty()) { @@ -70,7 +81,7 @@ class CommandUnlockserv : public Command } locked.clear(); - user->WriteNumeric(989, user->server->GetName(), "Open for new connections"); + user->WriteNumeric(RPL_SERVLOCKOFF, user->server->GetName(), "Open for new connections"); ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow new connections", user->nick.c_str()); return CMD_SUCCESS; } @@ -94,6 +105,12 @@ class ModuleLockserv : public Module locked.clear(); } + void OnModuleRehash(User* user, const std::string& param) CXX11_OVERRIDE + { + if (irc::equals(param, "lockserv") && !locked.empty()) + locked.clear(); + } + ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE { if (!locked.empty()) @@ -111,7 +128,7 @@ class ModuleLockserv : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Allows locking of the server to stop all incoming connections until unlocked again", VF_VENDOR); + return Version("Adds the /LOCKSERV and /UNLOCKSERV commands which allows server operators to control whether users can connect to the local server.", VF_VENDOR); } };