1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Allows locking of the server to stop all incoming connections till unlocked again */
19 * 988 <nick> <servername> :Closed for new connections
20 * 989 <nick> <servername> :Open for new connections
24 class CommandLockserv : public Command
30 CommandLockserv (InspIRCd* Instance, bool &lock)
31 : Command(Instance, "LOCKSERV", 'o', 0), locked(lock)
33 this->source = "m_lockserv.so";
37 CmdResult Handle (const char** parameters, int pcnt, User *user)
40 user->WriteServ("988 %s %s :Closed for new connections", user->nick, user->server);
41 ServerInstance->WriteOpers("*** Oper %s used LOCKSERV to temporarily close for new connections", user->nick);
42 /* Dont send to the network */
47 class CommandUnlockserv : public Command
53 CommandUnlockserv (InspIRCd* Instance, bool &lock)
54 : Command(Instance, "UNLOCKSERV", 'o', 0), locked(lock)
56 this->source = "m_lockserv.so";
60 CmdResult Handle (const char** parameters, int pcnt, User *user)
63 user->WriteServ("989 %s %s :Open for new connections", user->nick, user->server);
64 ServerInstance->WriteOpers("*** Oper %s used UNLOCKSERV to allow for new connections", user->nick);
65 /* Dont send to the network */
70 class ModuleLockserv : public Module
74 CommandLockserv* lockcommand;
75 CommandUnlockserv* unlockcommand;
77 virtual void ResetLocked()
83 ModuleLockserv(InspIRCd* Me) : Module(Me)
86 lockcommand = new CommandLockserv(ServerInstance, locked);
87 ServerInstance->AddCommand(lockcommand);
89 unlockcommand = new CommandUnlockserv(ServerInstance, locked);
90 ServerInstance->AddCommand(unlockcommand);
93 virtual ~ModuleLockserv()
97 void Implements(char* List)
99 List[I_OnUserRegister] = List[I_OnRehash] = List[I_OnCheckReady] = 1;
102 virtual void OnRehash(User* user, const std::string ¶meter)
107 virtual int OnUserRegister(User* user)
111 User::QuitUser(ServerInstance, user, "Server is temporarily closed. Please try again later.");
117 virtual bool OnCheckReady(User* user)
122 virtual Version GetVersion()
124 return Version(1, 0, 0, 1, VF_VENDOR, API_VERSION);
128 MODULE_INIT(ModuleLockserv)