From 1f541d7bbce6f2a254b3ba46ed9a31da593674de Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 11 Feb 2013 17:47:51 +0100 Subject: [PATCH] cmd_invite Correct error message when the user has no privs to invite and no halfop prefix is available --- src/commands/cmd_invite.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 8025296ae..e12b8244f 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -94,11 +94,13 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use { if (IS_LOCAL(user)) { - int rank = c->GetPrefixValue(user); + unsigned int rank = c->GetPrefixValue(user); if (rank < HALFOP_VALUE) { + // Check whether halfop mode is available and phrase error message accordingly + ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", - user->nick.c_str(), c->name.c_str(), rank >= HALFOP_VALUE ? "" : "half-"); + user->nick.c_str(), c->name.c_str(), (mh && mh->name == "halfop" ? "half-" : "")); return CMD_FAILURE; } } -- 2.39.5