X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fhelperfuncs.cpp;h=c5cfdd79a405c1418ad9eb8657d06e3c3b8da7fe;hb=8fa7e20b6b47d4de617e1bba2773606df569f11d;hp=66a84bbceca06aec9649d2e95e7d1bfacc1316d4;hpb=aab7998583ca16590a32c7bdb80955a18b090700;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 66a84bbce..c5cfdd79a 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -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; +}