diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-02-20 09:15:55 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-02-20 09:15:55 +0000 |
commit | 4d46f5f9ef94c295649afad38c6d496ae2bbe5e1 (patch) | |
tree | 683f3ac9a96238c40aeb04b9eaf37ee367d6f1bf /src/helperfuncs.cpp | |
parent | a5263a8adad14fa05bdc6f55d7d3fd84dd108903 (diff) |
Restore <options:exemptchanops> with long names
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12502 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r-- | src/helperfuncs.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 66a84bbce..98dd1fc7f 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -439,3 +439,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; + 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; +} |