]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_banredirect.cpp
Fix the 'i/o error on connection (no error)' stuff, by displaying 'connected closed...
[user/henk/code/inspircd.git] / src / modules / m_banredirect.cpp
index 5965811c446669e6fdeaf666c201561f4a0f390a..eaeb90ea82eb98b9ba765a7eeb78b19c75f01f84 100644 (file)
@@ -15,6 +15,7 @@
 #include "u_listmode.h"
 
 /* $ModDesc: Allows an extended ban (+b) syntax redirecting banned users to another channel */
+/* $ModDep: ../../include/u_listmode.h */
 
 /* Originally written by Om, January 2008
  */
@@ -62,6 +63,9 @@ class BanRedirect : public ModeWatcher
                        std::string::iterator start_pos = param.begin();
                        long maxbans = channel->GetMaxBans();
 
+                       if (param.length() >= 2 && param[1] == ':')
+                               return true;
+
                        if(adding && (channel->bans.size() > static_cast<unsigned>(maxbans)))
                        {
                                source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans);
@@ -291,12 +295,16 @@ class ModuleBanRedirect : public Module
 
                                for(BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); redir++)
                                {
-                                       if(ServerInstance->MatchText(user->GetFullRealHost(), redir->banmask) || ServerInstance->MatchText(user->GetFullHost(), redir->banmask) || ServerInstance->MatchText(ipmask, redir->banmask))
+                                       if(InspIRCd::Match(user->GetFullRealHost(), redir->banmask) || InspIRCd::Match(user->GetFullHost(), redir->banmask) || InspIRCd::MatchCIDR(ipmask, redir->banmask))
                                        {
                                                /* tell them they're banned and are being transferred */
                                                Channel* destchan = ServerInstance->FindChan(redir->targetchan);
+                                               std::string destlimit;
+
+                                               if (destchan)
+                                                       destlimit = destchan->GetModeParameter('l');
 
-                                               if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit))
+                                               if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str())))
                                                {
                                                        user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str());
                                                        return 1;
@@ -325,7 +333,7 @@ class ModuleBanRedirect : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1, 0, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 
        void Prioritize()