summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
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;
+}