From 6c7a3ceb6c674a9af09da955ee0238e9291cf29a Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 12 Nov 2013 06:51:31 -0500 Subject: Use WriteNumeric() everywhere we send numerics and include the user's nick automatically --- src/commands/cmd_topic.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/commands/cmd_topic.cpp') diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp index 8f5979865..38982a7a2 100644 --- a/src/commands/cmd_topic.cpp +++ b/src/commands/cmd_topic.cpp @@ -58,7 +58,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, Channel* c = ServerInstance->FindChan(parameters[0]); if (!c) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } @@ -68,18 +68,18 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, { if ((c->IsModeSet(secretmode)) && (!c->HasUser(user))) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str()); return CMD_FAILURE; } if (c->topic.length()) { - user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), c->name.c_str(), c->topic.c_str()); - user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); + user->WriteNumeric(RPL_TOPIC, "%s :%s", c->name.c_str(), c->topic.c_str()); + user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); } else { - user->WriteNumeric(RPL_NOTOPICSET, "%s %s :No topic is set.", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str()); } } return CMD_SUCCESS; @@ -95,12 +95,12 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, { if (!c->HasUser(user)) { - user->WriteNumeric(442, "%s %s :You're not on that channel!", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", c->name.c_str()); return CMD_FAILURE; } if (c->IsModeSet(topiclockmode) && !ServerInstance->OnCheckExemption(user, c, "topiclock").check(c->GetPrefixValue(user) >= HALFOP_VALUE)) { - user->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have access to change the topic on this channel", c->name.c_str()); return CMD_FAILURE; } } -- cgit v1.2.3