X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_privmsg.cpp;h=07d4a9cf7ba3d73310514906df881bc4a365ac2d;hb=d379dcab405bd4b0542e3c645a2de3c1a27832b8;hp=ed98c771f64f967fbede63e113faef7cacc39fff;hpb=8710724b5518ae9858309e548514f76e620a8459;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index ed98c771f..07d4a9cf7 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -112,13 +112,13 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& 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& 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& 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& 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; @@ -188,10 +188,10 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para nickonly.assign(destnick, 0, targetserver - destnick); dest = ServerInstance->FindNickOnly(nickonly); - if (dest && strcasecmp(dest->server.c_str(), targetserver + 1)) + if (dest && strcasecmp(dest->server->GetName().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& 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& 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; @@ -269,12 +269,6 @@ class ModuleCoreMessage : public Module { } - void init() - { - ServerInstance->Modules->AddService(CommandPrivmsg); - ServerInstance->Modules->AddService(CommandNotice); - } - Version GetVersion() { return Version("PRIVMSG, NOTICE", VF_CORE|VF_VENDOR);