summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-08-26 10:37:23 +0100
committerPeter Powell <petpow@saberuk.com>2018-08-26 11:33:23 +0100
commit33180223e318c304892b3fa8640f90f1ddf6f4b4 (patch)
tree72cfc55bc1de0840849908213589634ad6dd9b77
parent4567a325b8cfc87ddf1aea1c0db7623d3b068931 (diff)
Don't update the idle timer when a user replies to a CTCP.
Closes #1305.
-rw-r--r--src/coremods/core_privmsg.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/coremods/core_privmsg.cpp b/src/coremods/core_privmsg.cpp
index 65609df00..dae770abe 100644
--- a/src/coremods/core_privmsg.cpp
+++ b/src/coremods/core_privmsg.cpp
@@ -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);