aboutsummaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-04-12 12:48:54 +0100
committerGravatar Sadie Powell2022-04-12 12:48:54 +0100
commit7266f8681d603c58e1281f3e7e2934d61f910ea4 (patch)
treef836b95102576150c0deb52529d77eb3dfa0de0f /src/mode.cpp
parentUse ERR_RESTRICTED when an action can't be done even with privileges. (diff)
Add a numeric builder for the ERR_CHANOPRIVSNEEDED numeric.
This should make privilege errors more consistent.
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 8fdbcdea0..7ac165bf4 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -286,12 +286,8 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode
unsigned int ourrank = chan->GetPrefixValue(user);
if (ourrank < neededrank)
{
- const PrefixMode* neededmh = FindNearestPrefixMode(neededrank);
- if (neededmh)
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, InspIRCd::Format("You must have channel %s access or above to %sset channel mode %c",
- neededmh->name.c_str(), adding ? "" : "un", modechar));
- else
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, InspIRCd::Format("You cannot %sset channel mode %c", (adding ? "" : "un"), modechar));
+ user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, neededrank, InspIRCd::Format("%s channel mode %c (%s)",
+ adding ? "set" : "unset", mh->GetModeChar(), mh->name.c_str())));
return MODEACTION_DENY;
}
}