X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_exemptchanops.cpp;h=076445644ba2bfa84644d94eadff7b170a3ea5ed;hb=63aa8d0d42f619c52d382bde3e6ba2e5e23b12ac;hp=43ae21a1c0330b26b45e35b55cf21f59cd871430;hpb=0b3f568a7506fb7ddc9a24d6ab12a969befb923d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 43ae21a1c..076445644 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -29,9 +29,23 @@ class ExemptChanOps : public ListModeBase bool ValidateParam(User* user, Channel* chan, std::string &word) { - if (!ServerInstance->Modes->FindMode(word, MODETYPE_CHANNEL)) + std::string::size_type p = word.find(':'); + if (p == std::string::npos) { - user->WriteNumeric(955, "%s %s :Mode doesn't exist", chan->name.c_str(), word.c_str()); + user->WriteNumeric(955, "%s %s :Invalid exemptchanops entry, format is :", chan->name.c_str(), word.c_str()); + return false; + } + + std::string restriction(word, 0, p); + // If there is a '-' in the restriction string ignore it and everything after it + // to support "auditorium-vis" and "auditorium-see" in m_auditorium + p = restriction.find('-'); + if (p != std::string::npos) + restriction.erase(p); + + if (!ServerInstance->Modes->FindMode(restriction, MODETYPE_CHANNEL)) + { + user->WriteNumeric(955, "%s %s :Unknown restriction", chan->name.c_str(), restriction.c_str()); return false; } @@ -84,7 +98,7 @@ class ExemptHandler : public HandlerBase3mask.compare(0, pos, restriction)) - minmode = (*i).mask.substr(pos + 1); + minmode.assign(i->mask, pos + 1, std::string::npos); } }