From: Manuel Nickschas Date: Thu, 14 Nov 2013 20:31:18 +0000 (+0100) Subject: Fix datatypes in the legacy handshake X-Git-Tag: 0.10-beta1~103 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e583f46bbff3e4c73716b30b6a6d08adb6e44915;ds=sidebyside Fix datatypes in the legacy handshake Turns out we accidentally some datatypes. SupportsCompression should be a bool, and protocolVersion an uint. Changing this breaks QuasselDroid and wasn't done on purpose anyway. --- diff --git a/src/common/protocols/legacy/legacypeer.cpp b/src/common/protocols/legacy/legacypeer.cpp index eab7ea95..0766c5b3 100644 --- a/src/common/protocols/legacy/legacypeer.cpp +++ b/src/common/protocols/legacy/legacypeer.cpp @@ -25,9 +25,9 @@ #include "quassel.h" /* version.inc is no longer used for this */ -const int protocolVersion = 10; -const int coreNeedsProtocol = protocolVersion; -const int clientNeedsProtocol = protocolVersion; +const uint protocolVersion = 10; +const uint coreNeedsProtocol = protocolVersion; +const uint clientNeedsProtocol = protocolVersion; using namespace Protocol; @@ -178,9 +178,9 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg) if (msgType == "ClientInit") { // FIXME only in compat mode - int ver = m["ProtocolVersion"].toInt(); + uint ver = m["ProtocolVersion"].toUInt(); if (ver < coreNeedsProtocol) { - emit protocolVersionMismatch(ver, coreNeedsProtocol); + emit protocolVersionMismatch((int)ver, (int)coreNeedsProtocol); return; } @@ -199,9 +199,9 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg) else if (msgType == "ClientInitAck") { // FIXME only in compat mode - int ver = m["ProtocolVersion"].toInt(); + uint ver = m["ProtocolVersion"].toUInt(); // actually an UInt if (ver < clientNeedsProtocol) { - emit protocolVersionMismatch(ver, clientNeedsProtocol); + emit protocolVersionMismatch((int)ver, (int)clientNeedsProtocol); return; } #ifndef QT_NO_COMPRESS @@ -285,7 +285,7 @@ void LegacyPeer::dispatch(const ClientRegistered &msg) { // FIXME only in compat mode m["ProtocolVersion"] = protocolVersion; m["SupportSsl"] = msg.sslSupported; - m["SupportsCompression"] = socket()->property("UseCompression"); // this property gets already set in the ClientInit handler + m["SupportsCompression"] = socket()->property("UseCompression").toBool(); // this property gets already set in the ClientInit handler // This is only used for old v10 clients (pre-0.5) int uptime = msg.coreStartTime.secsTo(QDateTime::currentDateTime().toUTC());