]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_privmsg.cpp
Convert more modules
[user/henk/code/inspircd.git] / src / cmd_privmsg.cpp
index 1614a62dcf454062a74573732a3008488c8104b5..f3295df07e88f30d55a4d252bce3d8fb0d668b26 100644 (file)
@@ -18,9 +18,7 @@
 #include "wildcard.h"
 #include "commands/cmd_privmsg.h"
 
-
-
-extern "C" command_t* init_command(InspIRCd* Instance)
+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();
@@ -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,7 +124,13 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
        dest = ServerInstance->FindNick(parameters[0]);
        if (dest)
        {
-               if ((IS_LOCAL(user)) && (*dest->awaymsg))
+               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 */
                        user->WriteServ("301 %s %s :%s",user->nick,dest->nick,dest->awaymsg);