X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Feventstringifier.cpp;h=b8c67b9e898529efeec49f156443add9ed78f9a3;hb=cdc6091a2e02b84a48937cda287a0769ceb8726a;hp=c1279ffe3f0d00d9c355259ee6cf4bb9fc9416cf;hpb=6a63070246d89aa2a2474e3a9a1035fa889ad77e;p=quassel.git diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index c1279ffe..b8c67b9e 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -365,10 +365,11 @@ void EventStringifier::processIrcEventPart(IrcEvent *e) void EventStringifier::processIrcEventPong(IrcEvent *e) { - QString timestamp = e->params().at(1); - QTime sendTime = QTime::fromString(timestamp, "hh:mm:ss.zzz"); - if (!sendTime.isValid()) - displayMsg(e, Message::Server, "PONG " + e->params().join(" "), e->prefix()); + // CoreSessionEventProcessor will flag automated PONG replies as EventManager::Silent. There's + // no need to handle that specially here. + + // Format the PONG reply for display + displayMsg(e, Message::Server, "PONG " + e->params().join(" "), e->prefix()); } @@ -449,15 +450,21 @@ void EventStringifier::processIrcEvent301(IrcEvent *e) target = nick; IrcUser *ircuser = e->network()->ircUser(nick); if (ircuser) { - // FIXME: This needs converted to 64-bit time. - // For legacy protocol, keep the 32-bit signed int time. For modern protocol, just send - // the actual QDateTime() instead, don't bother converting it. - int now = QDateTime::currentDateTime().toTime_t(); - // FIXME: Convert to millisecond comparison, comment the constant value as needed - const int silenceTime = 60; - if (ircuser->lastAwayMessage() + silenceTime >= now) + QDateTime now = QDateTime::currentDateTime(); + now.setTimeSpec(Qt::UTC); + // Don't print "user is away" messages more often than this + // 1 hour = 60 min * 60 sec + const int silenceTime = 60 * 60; + // Check if away state has NOT changed and silence time hasn't yet elapsed + if (!ircuser->hasAwayChanged() + && ircuser->lastAwayMessageTime().addSecs(silenceTime) >= now) { + // Away message hasn't changed and we're still within the period of silence; don't + // repeat the message send = false; - ircuser->setLastAwayMessage(now); + } + ircuser->setLastAwayMessageTime(now); + // Mark any changes in away as acknowledged + ircuser->acknowledgeAwayChanged(); } } if (send) @@ -611,13 +618,13 @@ void EventStringifier::processIrcEvent322(IrcEvent *e) switch (e->params().count()) { case 3: topic = e->params()[2]; - [[clang::fallthrough]]; + // fallthrough case 2: userCount = e->params()[1].toUInt(); - [[clang::fallthrough]]; + /* fallthrough */ case 1: channelName = e->params()[0]; - [[clang::fallthrough]]; + // blubb default: break; }