From 026c579e4cac7d4545b3c8c3a0d690c8509dc713 Mon Sep 17 00:00:00 2001 From: B00mX0r Date: Tue, 19 Dec 2017 14:15:30 -0800 Subject: Fixed misc. instances of ERR_NOSUCHNICK instead of channel numerics Per #1122 --- src/coremods/core_channel/cmd_invite.cpp | 9 +++++++-- src/coremods/core_channel/cmd_join.cpp | 2 +- src/coremods/core_channel/cmd_kick.cpp | 9 +++++++-- src/coremods/core_channel/cmd_names.cpp | 2 +- src/coremods/core_channel/cmd_topic.cpp | 4 ++-- src/coremods/core_privmsg.cpp | 4 ++-- src/coremods/core_user/cmd_mode.cpp | 5 ++++- src/coremods/core_user/cmd_part.cpp | 2 +- 8 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src/coremods') diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index a1319ebc0..88b2cf86c 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -56,9 +56,14 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use timeout = ConvToInt(parameters[3]); } - if ((!c) || (!u) || (u->registered != REG_ALL)) + if (!c) { - user->WriteNumeric(Numerics::NoSuchNick(c ? parameters[0] : parameters[1])); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[1])); + return CMD_FAILURE; + } + if ((!u) || (u->registered != REG_ALL)) + { + user->WriteNumeric(Numerics::NoSuchNick(parameters[0])); return CMD_FAILURE; } diff --git a/src/coremods/core_channel/cmd_join.cpp b/src/coremods/core_channel/cmd_join.cpp index 06e203ead..a60f1b2c6 100644 --- a/src/coremods/core_channel/cmd_join.cpp +++ b/src/coremods/core_channel/cmd_join.cpp @@ -55,6 +55,6 @@ CmdResult CommandJoin::HandleLocal(const std::vector& parameters, L } } - user->WriteNumeric(ERR_NOSUCHCHANNEL, parameters[0], "Invalid channel name"); + user->WriteNumeric(ERR_BADCHANMASK, parameters[0], "Invalid channel name"); return CMD_FAILURE; } diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp index 420ed2b83..05e279751 100644 --- a/src/coremods/core_channel/cmd_kick.cpp +++ b/src/coremods/core_channel/cmd_kick.cpp @@ -42,9 +42,14 @@ CmdResult CommandKick::Handle (const std::vector& parameters, User else u = ServerInstance->FindNick(parameters[1]); - if ((!u) || (!c) || (u->registered != REG_ALL)) + if (!c) { - user->WriteNumeric(Numerics::NoSuchNick(c ? parameters[1] : parameters[0])); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); + return CMD_FAILURE; + } + if ((!u) || (u->registered != REG_ALL)) + { + user->WriteNumeric(Numerics::NoSuchNick(parameters[1])); return CMD_FAILURE; } diff --git a/src/coremods/core_channel/cmd_names.cpp b/src/coremods/core_channel/cmd_names.cpp index 21fe43cca..dd2926c33 100644 --- a/src/coremods/core_channel/cmd_names.cpp +++ b/src/coremods/core_channel/cmd_names.cpp @@ -62,7 +62,7 @@ CmdResult CommandNames::HandleLocal(const std::vector& parameters, } } - user->WriteNumeric(Numerics::NoSuchNick(parameters[0])); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); return CMD_FAILURE; } diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp index 835ac82ed..fe913225e 100644 --- a/src/coremods/core_channel/cmd_topic.cpp +++ b/src/coremods/core_channel/cmd_topic.cpp @@ -38,7 +38,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, Channel* c = ServerInstance->FindChan(parameters[0]); if (!c) { - user->WriteNumeric(Numerics::NoSuchNick(parameters[0])); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); return CMD_FAILURE; } @@ -46,7 +46,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, { if ((c->IsModeSet(secretmode)) && (!c->HasUser(user))) { - user->WriteNumeric(Numerics::NoSuchNick(c->name)); + user->WriteNumeric(Numerics::NoSuchChannel(c->name)); return CMD_FAILURE; } diff --git a/src/coremods/core_privmsg.cpp b/src/coremods/core_privmsg.cpp index d19ae09b5..89c74346e 100644 --- a/src/coremods/core_privmsg.cpp +++ b/src/coremods/core_privmsg.cpp @@ -180,8 +180,8 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para } else { - /* no such nick/channel */ - user->WriteNumeric(Numerics::NoSuchNick(target)); + /* channel does not exist */ + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); return CMD_FAILURE; } return CMD_SUCCESS; diff --git a/src/coremods/core_user/cmd_mode.cpp b/src/coremods/core_user/cmd_mode.cpp index 2b2652606..ec75d6191 100644 --- a/src/coremods/core_user/cmd_mode.cpp +++ b/src/coremods/core_user/cmd_mode.cpp @@ -45,7 +45,10 @@ CmdResult CommandMode::Handle(const std::vector& parameters, User* if ((!targetchannel) && (!targetuser)) { - user->WriteNumeric(Numerics::NoSuchNick(target)); + if (target[0] == '#') + user->WriteNumeric(Numerics::NoSuchChannel(target)); + else + user->WriteNumeric(Numerics::NoSuchNick(target)); return CMD_FAILURE; } if (parameters.size() == 1) diff --git a/src/coremods/core_user/cmd_part.cpp b/src/coremods/core_user/cmd_part.cpp index 4da2787d9..261d75a70 100644 --- a/src/coremods/core_user/cmd_part.cpp +++ b/src/coremods/core_user/cmd_part.cpp @@ -46,7 +46,7 @@ CmdResult CommandPart::Handle (const std::vector& parameters, User if (!c) { - user->WriteNumeric(Numerics::NoSuchNick(parameters[0])); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); return CMD_FAILURE; } -- cgit v1.2.3