]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_safelist.cpp
Fix memory leak and invalid vtable location on unload of m_sslinfo
[user/henk/code/inspircd.git] / src / modules / m_safelist.cpp
index b75390a4290cc086bbb967ce9370565e9b588f5e..bd1a541103dcd0f7af4dadeec0331aadef90e489 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.
@@ -40,7 +40,7 @@ class ModuleSafeList : public Module
  public:
        ModuleSafeList(InspIRCd* Me) : Module(Me)
        {
-               OnRehash(NULL, "");
+               OnRehash(NULL);
                Implementation eventlist[] = { I_OnBufferFlushed, I_OnPreCommand, I_OnCleanup, I_OnUserQuit, I_On005Numeric, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 6);
        }
@@ -49,7 +49,7 @@ class ModuleSafeList : public Module
        {
        }
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ConfigReader MyConf(ServerInstance);
                ThrottleSecs = MyConf.ReadInteger("safelist", "throttle", "60", 0, true);
@@ -68,24 +68,24 @@ class ModuleSafeList : public Module
         * OnPreCommand()
         *   Intercept the LIST command.
         */
-       virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+       virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
        {
                /* If the command doesnt appear to be valid, we dont want to mess with it. */
                if (!validated)
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                if (command == "LIST")
                {
                        return this->HandleList(parameters, user);
                }
-               return 0;
+               return MOD_RES_PASSTHRU;
        }
 
        /*
         * HandleList()
         *   Handle (override) the LIST command.
         */
-       int HandleList(const std::vector<std::string> &parameters, User* user)
+       ModResult HandleList(const std::vector<std::string> &parameters, User* user)
        {
                int pcnt = parameters.size();
                int minusers = 0, maxusers = 0;
@@ -95,7 +95,7 @@ class ModuleSafeList : public Module
                        user->WriteServ("NOTICE %s :*** Server load is currently too heavy. Please try again later.", user->nick.c_str());
                        user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str());
                        user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
-                       return 1;
+                       return MOD_RES_DENY;
                }
 
                /* First, let's check if the user is currently /list'ing */
@@ -105,7 +105,7 @@ class ModuleSafeList : public Module
                if (ld)
                {
                        /* user is already /list'ing, we don't want to do shit. */
-                       return 1;
+                       return MOD_RES_DENY;
                }
 
                /* Work around mIRC suckyness. YOU SUCK, KHALED! */
@@ -134,7 +134,7 @@ class ModuleSafeList : public Module
                                user->WriteServ("NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick.c_str());
                                user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str());
                                user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str());
-                               return 1;
+                               return MOD_RES_DENY;
                        }
 
                        delete last_list_time;
@@ -156,7 +156,7 @@ class ModuleSafeList : public Module
 
                global_listing++;
 
-               return 1;
+               return MOD_RES_DENY;
        }
 
        virtual void OnBufferFlushed(User* user)