]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_connectban.cpp
Attempt to revert r11734
[user/henk/code/inspircd.git] / src / modules / m_connectban.cpp
index 7c0659ad6b57ba1ac9a1f28b9701f4765a65c521..4d5011575691aeadc630fe099539a7753134f4a0 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.
@@ -29,7 +29,7 @@ class ModuleConnectBan : public Module
        {
                Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 3);
-               OnRehash(NULL, "");
+               OnRehash(NULL);
        }
 
        virtual ~ModuleConnectBan()
@@ -41,7 +41,7 @@ class ModuleConnectBan : public Module
                return Version("$Id$", VF_VENDOR,API_VERSION);
        }
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ConfigReader Conf(ServerInstance);
                std::string duration;
@@ -72,19 +72,13 @@ class ModuleConnectBan : public Module
                int range = 32;
                clonemap::iterator i;
 
-               switch (u->GetProtocolFamily())
+               switch (u->client_sa.sa.sa_family)
                {
-       #ifdef SUPPORT_IP6LINKS
                        case AF_INET6:
-                       {
                                range = ipv6_cidr;
-                       }
                        break;
-       #endif
                        case AF_INET:
-                       {
                                range = ipv4_cidr;
-                       }
                        break;
                }
 
@@ -103,7 +97,9 @@ class ModuleConnectBan : public Module
                                else
                                        delete zl;
 
-                               ServerInstance->SNO->WriteToSnoMask('x', "Connect flooding from IP range %s (%d)", u->GetCIDRMask(range), threshold);
+                               ServerInstance->SNO->WriteGlobalSno('x',"Module m_connectban added Z:line on *@%s to expire on %s: Connect flooding", 
+                                       u->GetCIDRMask(range), ServerInstance->TimeString(zl->expiry).c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', "Connect flooding from IP range %s (%d)", u->GetCIDRMask(range), threshold);
                                connects.erase(i);
                        }
                }