+ ExemptHandler(Module* me) : ec(me) {}
+
+ ModeHandler* FindMode(const std::string& mid)
+ {
+ if (mid.length() == 1)
+ return ServerInstance->Modes->FindMode(mid[0], MODETYPE_CHANNEL);
+ for(char c='A'; c < 'z'; c++)
+ {
+ ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL);
+ if (mh && mh->name == mid)
+ return mh;
+ }
+ return NULL;
+ }
+
+ ModResult Call(User* user, Channel* chan, const std::string& restriction)
+ {
+ unsigned int mypfx = chan->GetPrefixValue(user);
+ std::string minmode;
+
+ modelist* list = ec.extItem.get(chan);
+
+ if (list)
+ {
+ for (modelist::iterator i = list->begin(); i != list->end(); ++i)
+ {
+ std::string::size_type pos = (*i).mask.find(':');
+ if (pos == std::string::npos)
+ continue;
+ if ((*i).mask.substr(0,pos) == restriction)
+ minmode = (*i).mask.substr(pos + 1);
+ }
+ }
+
+ ModeHandler* mh = FindMode(minmode);
+ if (mh && mypfx >= mh->GetPrefixRank())
+ return MOD_RES_ALLOW;
+ if (mh || minmode == "*")
+ return MOD_RES_DENY;
+
+ return ServerInstance->HandleOnCheckExemption.Call(user, chan, restriction);
+ }
+};
+
+class ModuleExemptChanOps : public Module
+{