From 86597db6d33c40427dbc2bb4d1b781637e0c961c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 27 Mar 2014 20:15:22 +0100 Subject: [PATCH] Protocol::RegisterClient: add buildDate field This kills the dependency from DataStreamPeer to Quassel::buildInfo(). --- src/client/clientauthhandler.cpp | 2 +- src/common/protocol.h | 4 +++- src/common/protocols/datastream/datastreampeer.cpp | 5 ++--- src/common/protocols/legacy/legacypeer.cpp | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 9440419c..d5112d16 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -283,7 +283,7 @@ void ClientAuthHandler::startRegistration() useSsl = _account.useSsl(); #endif - _peer->dispatch(RegisterClient(Quassel::buildInfo().fancyVersionString, useSsl)); + _peer->dispatch(RegisterClient(Quassel::buildInfo().fancyVersionString, Quassel::buildInfo().buildDate, useSsl)); } diff --git a/src/common/protocol.h b/src/common/protocol.h index 9b1a45a4..053ab29b 100644 --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -56,11 +56,13 @@ struct HandshakeMessage { struct RegisterClient : public HandshakeMessage { - inline RegisterClient(const QString &clientVersion, bool sslSupported = false) + inline RegisterClient(const QString &clientVersion, const QString &buildDate, bool sslSupported = false) : clientVersion(clientVersion) + , buildDate(buildDate) , sslSupported(sslSupported) {} QString clientVersion; + QString buildDate; // this is only used by the LegacyProtocol in compat mode bool sslSupported; diff --git a/src/common/protocols/datastream/datastreampeer.cpp b/src/common/protocols/datastream/datastreampeer.cpp index b2e44434..52d5afa0 100644 --- a/src/common/protocols/datastream/datastreampeer.cpp +++ b/src/common/protocols/datastream/datastreampeer.cpp @@ -24,7 +24,6 @@ #include #include "datastreampeer.h" -#include "quassel.h" using namespace Protocol; @@ -117,7 +116,7 @@ void DataStreamPeer::handleHandshakeMessage(const QVariantList &mapData) } if (msgType == "ClientInit") { - handle(RegisterClient(m["ClientVersion"].toString(), false)); // UseSsl obsolete + handle(RegisterClient(m["ClientVersion"].toString(), m["ClientDate"].toString(), false)); // UseSsl obsolete } else if (msgType == "ClientInitReject") { @@ -168,7 +167,7 @@ void DataStreamPeer::dispatch(const RegisterClient &msg) { QVariantMap m; m["MsgType"] = "ClientInit"; m["ClientVersion"] = msg.clientVersion; - m["ClientDate"] = Quassel::buildInfo().buildDate; + m["ClientDate"] = msg.buildDate; writeMessage(m); } diff --git a/src/common/protocols/legacy/legacypeer.cpp b/src/common/protocols/legacy/legacypeer.cpp index 67e51300..982ffd7c 100644 --- a/src/common/protocols/legacy/legacypeer.cpp +++ b/src/common/protocols/legacy/legacypeer.cpp @@ -151,7 +151,7 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg) socket()->setProperty("UseCompression", true); } #endif - handle(RegisterClient(m["ClientVersion"].toString(), m["UseSsl"].toBool())); + handle(RegisterClient(m["ClientVersion"].toString(), m["ClientDate"].toString(), m["UseSsl"].toBool())); } else if (msgType == "ClientInitReject") { @@ -213,7 +213,7 @@ void LegacyPeer::dispatch(const RegisterClient &msg) { QVariantMap m; m["MsgType"] = "ClientInit"; m["ClientVersion"] = msg.clientVersion; - m["ClientDate"] = Quassel::buildInfo().buildDate; + m["ClientDate"] = msg.buildDate; // FIXME only in compat mode m["ProtocolVersion"] = protocolVersion; -- 2.20.1