summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-20 09:15:55 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-20 09:15:55 +0000
commit4d46f5f9ef94c295649afad38c6d496ae2bbe5e1 (patch)
tree683f3ac9a96238c40aeb04b9eaf37ee367d6f1bf /src/helperfuncs.cpp
parenta5263a8adad14fa05bdc6f55d7d3fd84dd108903 (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.cpp25
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;
+}