X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_channel%2Fcmd_names.cpp;h=28273c90394ce80567eadd98b24af23bc1b2e4e0;hb=f2e3fd5952b23209b084bde4f464e6643c8a00ff;hp=986dbe01889d7daa65b3c5822603f0c20f586c6d;hpb=5d050846f7f3f152422e56e5c871302ee7a5a1ed;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_channel/cmd_names.cpp b/src/coremods/core_channel/cmd_names.cpp index 986dbe018..28273c903 100644 --- a/src/coremods/core_channel/cmd_names.cpp +++ b/src/coremods/core_channel/cmd_names.cpp @@ -32,13 +32,13 @@ CommandNames::CommandNames(Module* parent) /** Handle /NAMES */ -CmdResult CommandNames::HandleLocal(const std::vector& parameters, LocalUser* user) +CmdResult CommandNames::HandleLocal(LocalUser* user, const Params& parameters) { Channel* c; - if (!parameters.size()) + if (parameters.empty()) { - user->WriteNumeric(RPL_ENDOFNAMES, "* :End of /NAMES list."); + user->WriteNumeric(RPL_ENDOFNAMES, '*', "End of /NAMES list."); return CMD_SUCCESS; } @@ -62,24 +62,23 @@ CmdResult CommandNames::HandleLocal(const std::vector& parameters, } } - user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); + user->WriteNumeric(Numerics::NoSuchChannel(parameters[0])); return CMD_FAILURE; } void CommandNames::SendNames(LocalUser* user, Channel* chan, bool show_invisible) { - Numeric::Builder<' '> reply(user, RPL_NAMREPLY, false); - std::string& list = reply.GetNumeric(); + Numeric::Builder<' '> reply(user, RPL_NAMREPLY, false, chan->name.size() + 3); + Numeric::Numeric& numeric = reply.GetNumeric(); if (chan->IsModeSet(secretmode)) - list.push_back('@'); + numeric.push(std::string(1, '@')); else if (chan->IsModeSet(privatemode)) - list.push_back('*'); + numeric.push(std::string(1, '*')); else - list.push_back('='); + numeric.push(std::string(1, '=')); - list.push_back(' '); - list.append(chan->name).append(" :"); - reply.SaveBeginPos(); + numeric.push(chan->name); + numeric.push(std::string()); std::string prefixlist; std::string nick; @@ -111,5 +110,5 @@ void CommandNames::SendNames(LocalUser* user, Channel* chan, bool show_invisible } reply.Flush(); - user->WriteNumeric(RPL_ENDOFNAMES, "%s :End of /NAMES list.", chan->name.c_str()); + user->WriteNumeric(RPL_ENDOFNAMES, chan->name, "End of /NAMES list."); }