X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcoremods%2Fcore_user%2Fcmd_part.cpp;h=9400eed9347cdd0526f43350d0cda66fd79f2ea1;hb=8b0d03971797110112acadf683e08301b094ca92;hp=9f82c15a501d5e1641998de5009c616625249c02;hpb=8f5efbc7aa33b792e02d01e3288f553e6e98ccaa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_user/cmd_part.cpp b/src/coremods/core_user/cmd_part.cpp index 9f82c15a5..9400eed93 100644 --- a/src/coremods/core_user/cmd_part.cpp +++ b/src/coremods/core_user/cmd_part.cpp @@ -25,10 +25,10 @@ CommandPart::CommandPart(Module* parent) : Command(parent, "PART", 1, 2) { Penalty = 5; - syntax = "{,} []"; + syntax = "[,]+ [:]"; } -CmdResult CommandPart::Handle (const std::vector& parameters, User *user) +CmdResult CommandPart::Handle(User* user, const Params& parameters) { std::string reason; if (parameters.size() > 1) @@ -44,20 +44,22 @@ CmdResult CommandPart::Handle (const std::vector& parameters, User Channel* c = ServerInstance->FindChan(parameters[0]); - if (c) + if (!c) { - c->PartUser(user, reason); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); + 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, c->name, "You're not on that channel"); return CMD_FAILURE; } return CMD_SUCCESS; } -RouteDescriptor CommandPart::GetRouting(User* user, const std::vector& parameters) +RouteDescriptor CommandPart::GetRouting(User* user, const Params& parameters) { return (IS_LOCAL(user) ? ROUTE_LOCALONLY : ROUTE_BROADCAST); }