From: Shane Synan Date: Tue, 21 Jul 2020 00:48:28 +0000 (-0400) Subject: core: Don't use "time" tag without "server-time" X-Git-Tag: 0.14-rc1~19 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=95f6cd0e720266733858d56b295548418cb86039 core: Don't use "time" tag without "server-time" Don't use the "time" IrcTagKey without "server-time" being enabled. This ensures that if "server-time" isn't negotiated, e.g. due to skipping the capability, message timestamps won't be adjusted. According to the IRCv3 specifications, servers must not send the "time" tag without "server-time" being acknowledged, however it's probably better to handle the case where a server might send it unprompted. See https://ircv3.net/specs/extensions/server-time-3.2 --- diff --git a/src/core/ircparser.cpp b/src/core/ircparser.cpp index 3bd86913..ccd39505 100644 --- a/src/core/ircparser.cpp +++ b/src/core/ircparser.cpp @@ -119,7 +119,7 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent* e) qDebug() << "IRC net" << net->networkId() << "<<" << tags << prefix << cmd << params; } - if (tags.contains(IrcTags::SERVER_TIME)) { + if (net->capEnabled(IrcCap::SERVER_TIME) && tags.contains(IrcTags::SERVER_TIME)) { QDateTime serverTime = QDateTime::fromString(tags[IrcTags::SERVER_TIME], "yyyy-MM-ddThh:mm:ss.zzzZ"); serverTime.setTimeSpec(Qt::UTC); if (serverTime.isValid()) {