summaryrefslogtreecommitdiff
path: root/src/commands/cmd_privmsg.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-11-12 06:51:31 -0500
committerAdam <Adam@anope.org>2013-11-12 06:51:31 -0500
commit6c7a3ceb6c674a9af09da955ee0238e9291cf29a (patch)
treec9fd79d5814685e43f5d9ade75cad5f11da06364 /src/commands/cmd_privmsg.cpp
parent407f8ef1391e5d09e99e0abfc570389decc3ce2d (diff)
Use WriteNumeric() everywhere we send numerics and include the user's nick automatically
Diffstat (limited to 'src/commands/cmd_privmsg.cpp')
-rw-r--r--src/commands/cmd_privmsg.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 5a8e23e9b..79437432f 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -112,13 +112,13 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
{
if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(user))
{
- user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (no external messages)", chan->name.c_str());
return CMD_FAILURE;
}
if (chan->IsModeSet(moderatedmode))
{
- user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (+m)", chan->name.c_str());
return CMD_FAILURE;
}
@@ -126,7 +126,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
{
if (chan->IsBanned(user))
{
- user->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", user->nick.c_str(), chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str());
return CMD_FAILURE;
}
}
@@ -143,7 +143,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
/* Check again, a module may have zapped the input string */
if (temp.empty())
{
- user->WriteNumeric(412, "%s :No text to send", user->nick.c_str());
+ user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send");
return CMD_FAILURE;
}
@@ -170,7 +170,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
else
{
/* no such nick/channel */
- user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), target);
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", target);
return CMD_FAILURE;
}
return CMD_SUCCESS;
@@ -191,7 +191,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
if (dest && strcasecmp(dest->server.c_str(), targetserver + 1))
{
/* Incorrect server for user */
- 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;
}
}
@@ -205,14 +205,14 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
{
if (parameters[1].empty())
{
- user->WriteNumeric(412, "%s :No text to send", user->nick.c_str());
+ user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send");
return CMD_FAILURE;
}
if ((dest->IsAway()) && (mt == MSG_PRIVMSG))
{
/* auto respond with aweh msg */
- user->WriteNumeric(301, "%s %s :%s", user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
+ user->WriteNumeric(RPL_AWAY, "%s :%s", dest->nick.c_str(), dest->awaymsg.c_str());
}
ModResult MOD_RESULT;
@@ -237,7 +237,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
else
{
/* no such nick/channel */
- 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;
}
return CMD_SUCCESS;