diff options
| author | 2014-02-20 13:34:27 +0100 | |
|---|---|---|
| committer | 2014-02-20 13:34:27 +0100 | |
| commit | 5303501b930d3d6c765c24ff69edb722d8a6b5f1 (patch) | |
| tree | f19fab0754dfe58e548ed389fa0e669b4af4ee48 /src/modules/m_exemptchanops.cpp | |
| parent | Create a name -> ModeHandler* map (diff) | |
Add a ModeParser::FindMode() overload that takes a mode name and a mode type
Diffstat (limited to 'src/modules/m_exemptchanops.cpp')
| -rw-r--r-- | src/modules/m_exemptchanops.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 7eb13690a..14050430f 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -29,10 +29,9 @@ class ExemptChanOps : public ListModeBase bool ValidateParam(User* user, Channel* chan, std::string &word) { - // TODO actually make sure there's a prop for this - if ((word.length() > 35) || (word.empty())) + if (!ServerInstance->Modes->FindMode(word, MODETYPE_CHANNEL)) { - user->WriteNumeric(955, "%s %s :word is too %s for exemptchanops list", chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); + user->WriteNumeric(955, "%s %s :Mode doesn't exist", chan->name.c_str(), word.c_str()); return false; } @@ -66,14 +65,8 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std: if (mid.length() == 1) return ServerInstance->Modes->FindPrefixMode(mid[0]); - const ModeParser::PrefixModeList& pmlist = ServerInstance->Modes->GetPrefixModes(); - for (ModeParser::PrefixModeList::const_iterator i = pmlist.begin(); i != pmlist.end(); ++i) - { - PrefixMode* mh = *i; - if (mh->name == mid) - return mh; - } - return NULL; + ModeHandler* mh = ServerInstance->Modes->FindMode(mid, MODETYPE_CHANNEL); + return mh ? mh->IsPrefixMode() : NULL; } ModResult Call(User* user, Channel* chan, const std::string& restriction) |
