From 934ca973157d8f9085cd16ad7bb4f60e697a9748 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 28 Dec 2015 17:29:00 +0100 Subject: cmd_part Send ERR_NOTONCHANNEL if the user is not on the channel Fixes issue #1117 reported by @ProgVal --- src/coremods/core_user/cmd_part.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/coremods/core_user/cmd_part.cpp b/src/coremods/core_user/cmd_part.cpp index 9f82c15a5..77aafd1b3 100644 --- a/src/coremods/core_user/cmd_part.cpp +++ b/src/coremods/core_user/cmd_part.cpp @@ -44,13 +44,15 @@ CmdResult CommandPart::Handle (const std::vector& parameters, User Channel* c = ServerInstance->FindChan(parameters[0]); - if (c) + if (!c) { - c->PartUser(user, reason); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); + return CMD_FAILURE; } - else + + if (!c->PartUser(user, reason)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel", c->name.c_str()); return CMD_FAILURE; } -- cgit v1.2.3