]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_lockserv.cpp
Include explicit routing information in Command, will replace CMD_LOCALONLY return...
[user/henk/code/inspircd.git] / src / modules / m_lockserv.cpp
index 9c9baa522a73f1d79f559eb6ae47a435a61262cf..77dc5a219dfbc762a1f2b4dfe652dc37f365e781 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -34,11 +34,11 @@ public:
                syntax.clear();
        }
 
-       CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+       CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
                locked = true;
-               user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick, user->server);
-               ServerInstance->SNO->WriteToSnoMask('A', "Oper %s used LOCKSERV to temporarily close for new connections", user->nick);
+               user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick.c_str(), user->server);
+               ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily close for new connections", user->nick.c_str());
                /* Dont send to the network */
                return CMD_LOCALONLY;
        }
@@ -57,11 +57,11 @@ public:
                syntax.clear();
        }
 
-       CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+       CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
                locked = false;
-               user->WriteNumeric(989, "%s %s :Open for new connections", user->nick, user->server);
-               ServerInstance->SNO->WriteToSnoMask('A', "Oper %s used UNLOCKSERV to allow for new connections", user->nick);
+               user->WriteNumeric(989, "%s %s :Open for new connections", user->nick.c_str(), user->server);
+               ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow for new connections", user->nick.c_str());
                /* Dont send to the network */
                return CMD_LOCALONLY;
        }
@@ -71,8 +71,8 @@ class ModuleLockserv : public Module
 {
 private:
        bool locked;
-       CommandLockserv* lockcommand;
-       CommandUnlockserv* unlockcommand;
+       CommandLockserv lockcommand;
+       CommandUnlockserv unlockcommand;
 
        virtual void ResetLocked()
        {
@@ -80,14 +80,11 @@ private:
        }
 
 public:
-       ModuleLockserv(InspIRCd* Me) : Module(Me)
+       ModuleLockserv(InspIRCd* Me) : Module(Me), lockcommand(Me, locked), unlockcommand(Me, locked)
        {
                ResetLocked();
-               lockcommand = new CommandLockserv(ServerInstance, locked);
-               ServerInstance->AddCommand(lockcommand);
-
-               unlockcommand = new CommandUnlockserv(ServerInstance, locked);
-               ServerInstance->AddCommand(unlockcommand);
+               ServerInstance->AddCommand(&lockcommand);
+               ServerInstance->AddCommand(&unlockcommand);
                Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady };
                ServerInstance->Modules->Attach(eventlist, this, 3);
        }
@@ -97,7 +94,7 @@ public:
        }
 
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ResetLocked();
        }
@@ -106,7 +103,7 @@ public:
        {
                if (locked)
                {
-                       User::QuitUser(ServerInstance, user, "Server is temporarily closed. Please try again later.");
+                       ServerInstance->Users->QuitUser(user, "Server is temporarily closed. Please try again later.");
                        return 1;
                }
                return 0;
@@ -119,7 +116,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version(1, 0, 0, 1, VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
 };