X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_privmsg.cpp;h=04f5009519b0e8ad53a3d5920e513b0685b2ac19;hb=107595610061e05871094ef6161a287c1dd53737;hp=a99f8a594cfe4224a255f2a1f02fa52897f022ff;hpb=9cf56d917d92959701694477f7944d45ad2c38ed;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index a99f8a594..04f500951 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -18,8 +18,6 @@ #include "wildcard.h" #include "commands/cmd_privmsg.h" - - extern "C" DllExport command_t* init_command(InspIRCd* Instance) { return new cmd_privmsg(Instance); @@ -29,7 +27,6 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) { userrec *dest; chanrec *chan; - CUList except_list; user->idle_lastmsg = ServerInstance->Time(); @@ -70,12 +67,12 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) { if (IS_LOCAL(user)) { - if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user))) + if ((chan->IsModeSet('n')) && (!chan->HasUser(user))) { user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name); return CMD_FAILURE; } - if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE)) + if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE)) { user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name); return CMD_FAILURE; @@ -90,9 +87,10 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) } parameters[1] = temp.c_str(); + /* Check again, a module may have zapped the input string */ if (temp.empty()) { - user->WriteServ("412 %s No text to send", user->nick); + user->WriteServ("412 %s :No text to send", user->nick); return CMD_FAILURE; } @@ -126,6 +124,12 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) dest = ServerInstance->FindNick(parameters[0]); if (dest) { + if (!*parameters[1]) + { + user->WriteServ("412 %s :No text to send", user->nick); + return CMD_FAILURE; + } + if (IS_AWAY(dest)) { /* auto respond with aweh msg */