]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_connectban.cpp
Extbans can be VF_OPTCOMMON as they do not desync on module add/remove
[user/henk/code/inspircd.git] / src / modules / m_connectban.cpp
index 9506bc2fecb16df06ce2fff86a10cd999e82bf8a..98fa3b847bcc9ec4f7f556128e5432fe233c3919 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -81,7 +81,8 @@ class ModuleConnectBan : public Module
                        break;
                }
 
-               i = connects.find(u->GetCIDRMask(range));
+               irc::sockets::cidr_mask mask(u->client_sa, range);
+               i = connects.find(mask);
 
                if (i != connects.end())
                {
@@ -90,21 +91,21 @@ class ModuleConnectBan : public Module
                        if (i->second >= threshold)
                        {
                                // Create zline for set duration.
-                               ZLine* zl = new ZLine(ServerInstance->Time(), banduration, ServerInstance->Config->ServerName.c_str(), "Connect flooding", u->GetCIDRMask(range));
+                               ZLine* zl = new ZLine(ServerInstance->Time(), banduration, ServerInstance->Config->ServerName.c_str(), "Connect flooding", mask.str().c_str());
                                if (ServerInstance->XLines->AddLine(zl,NULL))
                                        ServerInstance->XLines->ApplyLines();
                                else
                                        delete zl;
 
                                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);
+                                       mask.str().c_str(), ServerInstance->TimeString(zl->expiry).c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', "Connect flooding from IP range %s (%d)", mask.str().c_str(), threshold);
                                connects.erase(i);
                        }
                }
                else
                {
-                       connects[u->GetCIDRMask(range)] = 1;
+                       connects[mask] = 1;
                }
        }