]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_privmsg.cpp
Merge pull request #545 from SaberUK/master+logging-cleanup
[user/henk/code/inspircd.git] / src / commands / cmd_privmsg.cpp
index cefdd48008b5c8d24e1685156aac99d9d0f9dc35..b04e63d0080f3dd58616ef14699c6347f65f4c63 100644 (file)
@@ -56,7 +56,9 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
        Channel *chan;
        CUList except_list;
 
-       user->idle_lastmsg = ServerInstance->Time();
+       LocalUser* localuser = IS_LOCAL(user);
+       if (localuser)
+               localuser->idle_lastmsg = ServerInstance->Time();
 
        if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
                return CMD_SUCCESS;
@@ -68,7 +70,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
 
                ModResult MOD_RESULT;
                std::string temp = parameters[1];
-               FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list));
+               FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list, MSG_PRIVMSG));
                if (MOD_RESULT == MOD_RES_DENY)
                        return CMD_FAILURE;
 
@@ -80,7 +82,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                {
                        user->SendAll("PRIVMSG", "%s", text);
                }
-               FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
+               FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list, MSG_PRIVMSG));
                return CMD_SUCCESS;
        }
        char status = 0;
@@ -99,7 +101,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
 
                if (chan)
                {
-                       if (IS_LOCAL(user) && chan->GetPrefixValue(user) < VOICE_VALUE)
+                       if (localuser && chan->GetPrefixValue(user) < VOICE_VALUE)
                        {
                                if (chan->IsModeSet('n') && !chan->HasUser(user))
                                {
@@ -125,7 +127,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                        ModResult MOD_RESULT;
 
                        std::string temp = parameters[1];
-                       FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status,except_list));
+                       FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, chan, TYPE_CHANNEL, temp, status, except_list, MSG_PRIVMSG));
                        if (MOD_RESULT == MOD_RES_DENY)
                                return CMD_FAILURE;
 
@@ -156,7 +158,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                                chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name.c_str(), text);
                        }
 
-                       FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,text,status,except_list));
+                       FOREACH_MOD(I_OnUserMessage, OnUserMessage(user,chan, TYPE_CHANNEL, text, status, except_list, MSG_PRIVMSG));
                }
                else
                {
@@ -169,7 +171,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
 
        const char* destnick = parameters[0].c_str();
 
-       if (IS_LOCAL(user))
+       if (localuser)
        {
                const char* targetserver = strchr(destnick, '@');
 
@@ -200,7 +202,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                        return CMD_FAILURE;
                }
 
-               if (IS_AWAY(dest))
+               if (dest->IsAway())
                {
                        /* auto respond with aweh msg */
                        user->WriteNumeric(301, "%s %s :%s", user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
@@ -209,7 +211,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                ModResult MOD_RESULT;
 
                std::string temp = parameters[1];
-               FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list));
+               FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list, MSG_PRIVMSG));
                if (MOD_RESULT == MOD_RES_DENY)
                        return CMD_FAILURE;
 
@@ -223,7 +225,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                        user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick.c_str(), text);
                }
 
-               FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list));
+               FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list, MSG_PRIVMSG));
        }
        else
        {