From: Manuel Nickschas Date: Sun, 6 Jul 2008 20:33:55 +0000 (+0200) Subject: Fix protocol version check X-Git-Tag: 0.3.0~275^2~1 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b6ed0204146ba56b5ee0d17182c6f378a0d30f04 Fix protocol version check --- diff --git a/src/client/clientsyncer.cpp b/src/client/clientsyncer.cpp index e0b502b6..6759973d 100644 --- a/src/client/clientsyncer.cpp +++ b/src/client/clientsyncer.cpp @@ -186,8 +186,10 @@ void ClientSyncer::coreSocketDisconnected() { void ClientSyncer::clientInitAck(const QVariantMap &msg) { // Core has accepted our version info and sent its own. Let's see if we accept it as well... - if((msg.contains("CoreBuild") && msg["CoreBuild"].toUInt() < 732) // legacy! - || (!msg.contains("CoreBuild") && msg["ProtocolVersion"].toUInt() < Global::clientNeedsProtocol)) { + uint ver = 0; + if(!msg.contains("ProtocolVersion") && msg["CoreBuild"].toUInt() >= 732) ver = 1; // legacy! + if(msg.contains("ProtocolVersion")) ver = msg["ProtocolVersion"].toUInt(); + if(ver < Global::clientNeedsProtocol) { emit connectionError(tr("The Quassel Core you are trying to connect to is too old!
" "Need at least core/client protocol v%1 to connect.").arg(Global::clientNeedsProtocol)); disconnectFromCore(); diff --git a/src/core/core.cpp b/src/core/core.cpp index 31a409f5..18339272 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -394,8 +394,10 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { QVariantMap reply; // Just version information -- check it! - if((msg.contains("ClientBuild") && msg["ClientBuild"].toUInt() < 732) - || (!msg.contains("ClientBuild") && msg["ProtocolVersion"].toUInt() < Global::coreNeedsProtocol)) { + uint ver = 0; + if(!msg.contains("ProtocolVersion") && msg["ClientBuild"].toUInt() >= 732) ver = 1; // FIXME legacy + if(msg.contains("ProtocolVersion")) ver = msg["ProtocolVersion"].toUInt(); + if(ver < Global::coreNeedsProtocol) { reply["MsgType"] = "ClientInitReject"; reply["Error"] = tr("Your Quassel Client is too old!
" "This core needs at least client/core protocol version %1.
"