From 252f2b4f2b1027da7cf41d06e779305767048f14 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 10 Jun 2014 17:22:02 +0200 Subject: cmd_kick Assign a value to the kick reason string more reasonably --- src/coremods/core_channel/cmd_kick.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp index d646d9a45..dfa9bf217 100644 --- a/src/coremods/core_channel/cmd_kick.cpp +++ b/src/coremods/core_channel/cmd_kick.cpp @@ -31,7 +31,6 @@ CommandKick::CommandKick(Module* parent) */ CmdResult CommandKick::Handle (const std::vector& parameters, User *user) { - std::string reason; Channel* c = ServerInstance->FindChan(parameters[0]); User* u; @@ -74,14 +73,8 @@ CmdResult CommandKick::Handle (const std::vector& parameters, User } Membership* const memb = victimiter->second; - if (parameters.size() > 2) - { - reason.assign(parameters[2], 0, ServerInstance->Config->Limits.MaxKick); - } - else - { - reason.assign(user->nick, 0, ServerInstance->Config->Limits.MaxKick); - } + const bool has_reason = (parameters.size() > 2); + const std::string reason((has_reason ? parameters.back() : user->nick), 0, ServerInstance->Config->Limits.MaxKick); // Do the following checks only if the KICK is done by a local user; // each server enforces its own rules. -- cgit v1.2.3