diff options
author | Adam <Adam@anope.org> | 2016-10-04 21:28:43 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-10-04 21:28:43 -0400 |
commit | 99acdcf168f16764012869e7c9f85e6bfae6f23b (patch) | |
tree | c5803396084b138ff652fd680a1a73985e6f4207 | |
parent | e95950ee261a6a738898d24a76310ef26585e35a (diff) |
cs_mode: check chanserv privilege too for status modes on set
-rw-r--r-- | modules/commands/cs_mode.cpp | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 11d2cc467..196952d12 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -325,27 +325,42 @@ class CommandCSMode : public Command Anope::string mode_param; if (((cm->type == MODE_STATUS || cm->type == MODE_LIST) && !sep.GetToken(mode_param)) || (cm->type == MODE_PARAM && adding && !sep.GetToken(mode_param))) + { source.Reply(_("Missing parameter for mode %c."), cm->mchar); - else if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c)) + continue; + } + + if (cm->type == MODE_STATUS && !CanSet(source, ci, cm, false)) + { + source.Reply(ACCESS_DENIED); + continue; + } + + if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c)) + { source.Reply(_("List for mode %c is full."), cm->mchar); - else if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "32")) + continue; + } + + if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "32")) + { source.Reply(_("The mode lock list of \002%s\002 is full."), ci->name.c_str()); + continue; + } + + modelocks->SetMLock(cm, adding, mode_param, source.GetNick()); + + if (adding) + { + pos += cm->mchar; + if (!mode_param.empty()) + pos_params += " " + mode_param; + } else { - modelocks->SetMLock(cm, adding, mode_param, source.GetNick()); - - if (adding) - { - pos += cm->mchar; - if (!mode_param.empty()) - pos_params += " " + mode_param; - } - else - { - neg += cm->mchar; - if (!mode_param.empty()) - neg_params += " " + mode_param; - } + neg += cm->mchar; + if (!mode_param.empty()) + neg_params += " " + mode_param; } } } |