summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-12-28 17:29:00 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-12-28 17:29:00 +0100
commit934ca973157d8f9085cd16ad7bb4f60e697a9748 (patch)
tree9c743ec15a0e99de7e1d4c190cda6e4943833e13
parente17fcc226b04ea62c6ab4444bc1175a93f5fce57 (diff)
cmd_part Send ERR_NOTONCHANNEL if the user is not on the channel
Fixes issue #1117 reported by @ProgVal
-rw-r--r--src/coremods/core_user/cmd_part.cpp10
1 files 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<std::string>& 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;
}