]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
Add IPV6_V6ONLY support
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index 66a84bbceca06aec9649d2e95e7d1bfacc1316d4..c5cfdd79a405c1418ad9eb8657d06e3c3b8da7fe 100644 (file)
@@ -173,6 +173,9 @@ bool InspIRCd::IsValidMask(const std::string &mask)
        if (exclamation != 1 || atsign != 1)
                return false;
 
+       if (mask.length() > 250)
+               return false;
+
        return true;
 }
 
@@ -439,3 +442,28 @@ void GenRandomHandler::Call(char *output, size_t max)
        for(unsigned int i=0; i < max; i++)
                output[i] = random();
 }
+
+ModResult OnCheckExemptionHandler::Call(User* user, Channel* chan, const std::string& restriction)
+{
+       unsigned int mypfx = chan->GetPrefixValue(user);
+       char minmode = 0;
+       std::string current;
+
+       irc::spacesepstream defaultstream(ServerInstance->Config->ConfValue("options")->getString("exemptchanops"));
+
+       while (defaultstream.GetToken(current))
+       {
+               std::string::size_type pos = current.find(':');
+               if (pos == std::string::npos)
+                       continue;
+               if (current.substr(0,pos) == restriction)
+                       minmode = current[pos+1];
+       }
+
+       ModeHandler* mh = ServerInstance->Modes->FindMode(minmode, MODETYPE_CHANNEL);
+       if (mh && mypfx >= mh->GetPrefixRank())
+               return MOD_RES_ALLOW;
+       if (mh || minmode == '*')
+               return MOD_RES_DENY;
+       return MOD_RES_PASSTHRU;
+}