+ ModResult AccessCheck(User* source, Channel* channel, std::string ¶meter, bool adding)
+ {
+ std::string::size_type pos = parameter.find(':');
+ if (pos == 0 || pos == std::string::npos)
+ return adding ? MOD_RES_DENY : MOD_RES_PASSTHRU;
+ unsigned int mylevel = channel->GetPrefixValue(source);
+ std::string mid(parameter, 0, pos);
+ PrefixMode* mh = FindMode(mid);
+
+ if (adding && !mh)
+ {
+ source->WriteNumeric(415, "%s :Cannot find prefix mode '%s' for autoop",
+ mid.c_str(), mid.c_str());
+ return MOD_RES_DENY;
+ }
+ else if (!mh)
+ return MOD_RES_PASSTHRU;
+
+ std::string dummy;
+ if (mh->AccessCheck(source, channel, dummy, true) == MOD_RES_DENY)
+ return MOD_RES_DENY;
+ if (mh->GetLevelRequired() > mylevel)
+ {
+ source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be able to set mode '%s' to include it in an autoop",
+ channel->name.c_str(), mid.c_str());
+ return MOD_RES_DENY;
+ }
+ return MOD_RES_PASSTHRU;
+ }
+};