From 7266f8681d603c58e1281f3e7e2934d61f910ea4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 12 Apr 2022 12:48:54 +0100 Subject: Add a numeric builder for the ERR_CHANOPRIVSNEEDED numeric. This should make privilege errors more consistent. --- src/mode.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/mode.cpp') 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; } } -- cgit v1.3.1-10-gc9f91