]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Don't update the idle timer when a user replies to a CTCP.
authorPeter Powell <petpow@saberuk.com>
Sun, 26 Aug 2018 09:37:23 +0000 (10:37 +0100)
committerPeter Powell <petpow@saberuk.com>
Sun, 26 Aug 2018 10:33:23 +0000 (11:33 +0100)
Closes #1305.

src/coremods/core_privmsg.cpp

index 65609df00acaaaa20029b3d1468a46924a257302..dae770abef57588601c00ff5f625e8a592af3e4e 100644 (file)
@@ -148,10 +148,6 @@ CmdResult MessageCommandBase::HandleMessage(User* user, const Params& parameters
        User *dest;
        Channel *chan;
 
-       LocalUser* localuser = IS_LOCAL(user);
-       if (localuser)
-               localuser->idle_lastmsg = ServerInstance->Time();
-
        if (CommandParser::LoopCall(user, this, parameters, 0))
                return CMD_SUCCESS;
 
@@ -195,7 +191,7 @@ CmdResult MessageCommandBase::HandleMessage(User* user, const Params& parameters
 
                if (chan)
                {
-                       if (localuser && chan->GetPrefixValue(user) < VOICE_VALUE)
+                       if (IS_LOCAL(user) && chan->GetPrefixValue(user) < VOICE_VALUE)
                        {
                                if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(user))
                                {
@@ -259,7 +255,7 @@ CmdResult MessageCommandBase::HandleMessage(User* user, const Params& parameters
 
        const char* destnick = parameters[0].c_str();
 
-       if (localuser)
+       if (IS_LOCAL(user))
        {
                const char* targetserver = strchr(destnick, '@');
 
@@ -357,6 +353,20 @@ class ModuleCoreMessage : public Module
        {
        }
 
+       void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE
+       {
+               // We only handle the idle times of local users.
+               LocalUser* luser = IS_LOCAL(user);
+               if (!luser)
+                       return;
+
+               // We don't update the idle time when a CTCP reply is sent.
+               if (details.type == MSG_NOTICE && details.IsCTCP())
+                       return;
+
+               luser->idle_lastmsg = ServerInstance->Time();
+       }
+
        Version GetVersion() CXX11_OVERRIDE
        {
                return Version("PRIVMSG, NOTICE", VF_CORE|VF_VENDOR);