X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Feventstringifier.cpp;h=b8c67b9e898529efeec49f156443add9ed78f9a3;hb=6bfa260800588318e5a7b17e3b9dbfaa67bba635;hp=b4ba3ad5776edd4d1fae6a3bbf62fe8c73d4a2d8;hpb=425364f5f68a37582ddfa0494f4305f98f761e23;p=quassel.git diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index b4ba3ad5..b8c67b9e 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -365,29 +365,11 @@ void EventStringifier::processIrcEventPart(IrcEvent *e) void EventStringifier::processIrcEventPong(IrcEvent *e) { - // Some IRC servers respond with only one parameter, others respond with two, with the latter - // being the text sent. Handle both situations. - QString timestamp; - if (e->params().count() < 2) { - // Only one parameter received - // :localhost PONG 02:43:49.565 - timestamp = e->params().at(0); - } else { - // Two parameters received, pick the second - // :localhost PONG localhost :02:43:49.565 - timestamp = e->params().at(1); - } + // CoreSessionEventProcessor will flag automated PONG replies as EventManager::Silent. There's + // no need to handle that specially here. - // Attempt to parse the timestamp - QTime sendTime = QTime::fromString(timestamp, "hh:mm:ss.zzz"); - if (!sendTime.isValid()) { - // No valid timestamp found, this is most likely a user-specified PING message. - // - // Or the IRC server is returning whatever it feels like to PING messages, in which case.. - // sorry. Increase the ping timeout delay in Quassel to as high as possible, and go - // encourage your IRC server developer to fix their stuff. - displayMsg(e, Message::Server, "PONG " + e->params().join(" "), e->prefix()); - } + // Format the PONG reply for display + displayMsg(e, Message::Server, "PONG " + e->params().join(" "), e->prefix()); } @@ -471,10 +453,18 @@ void EventStringifier::processIrcEvent301(IrcEvent *e) QDateTime now = QDateTime::currentDateTime(); now.setTimeSpec(Qt::UTC); // Don't print "user is away" messages more often than this - const int silenceTime = 60; - if (ircuser->lastAwayMessageTime().addSecs(silenceTime) >= now) + // 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->setLastAwayMessageTime(now); + // Mark any changes in away as acknowledged + ircuser->acknowledgeAwayChanged(); } } if (send) @@ -628,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; }