X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientauthhandler.cpp;h=b8a62efab9f62986b572d3d4c6a641a86f74e876;hp=60407981a6fb5e8ca22225cc8641119946baf190;hb=921e54680da16fcf2adb7a90506875aceb6633a4;hpb=c545a47b64dffdf3892ff4cea466b61c84d98f8f diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 60407981..b8a62efa 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2015 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -114,7 +114,9 @@ void ClientAuthHandler::onSocketStateChanged(QAbstractSocket::SocketState socket text = tr("Disconnected"); // Ensure the disconnected() signal is sent even if we haven't reached the Connected state yet. // The baseclass implementation will make sure to only send the signal once. - onSocketDisconnected(); + // However, we do want to prefer a potential socket error signal that may be on route already, so + // give this a chance to overtake us by spinning the loop... + QTimer::singleShot(0, this, SLOT(onSocketDisconnected())); } break; default: @@ -173,7 +175,7 @@ void ClientAuthHandler::onSocketConnected() if (_account.useSsl()) magic |= Protocol::Encryption; #endif - //magic |= Protocol::Compression; // not implemented yet + magic |= Protocol::Compression; stream << magic; @@ -195,7 +197,7 @@ void ClientAuthHandler::onSocketConnected() qDebug() << "Legacy core detected, switching to compatibility mode"; - RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), this); + RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), Compressor::NoCompression, this); // Only needed for the legacy peer, as all others check the protocol version before instantiation connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int))); @@ -222,7 +224,13 @@ void ClientAuthHandler::onReadyRead() quint16 protoFeatures = static_cast(reply>>8 & 0xffff); _connectionFeatures = static_cast(reply>>24); - RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(type, protoFeatures), this, socket(), this); + Compressor::CompressionLevel level; + if (_connectionFeatures & Protocol::Compression) + level = Compressor::BestCompression; + else + level = Compressor::NoCompression; + + RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(type, protoFeatures), this, socket(), level, this); if (!peer) { qWarning() << "No valid protocol supported for this core!"; emit errorPopup(tr("Incompatible Quassel Core!
" @@ -251,6 +259,8 @@ void ClientAuthHandler::onProtocolVersionMismatch(int actual, int expected) void ClientAuthHandler::setPeer(RemotePeer *peer) { + qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "..."; + _peer = peer; connect(_peer, SIGNAL(transferProgress(int,int)), SIGNAL(transferProgress(int,int))); @@ -273,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)); }