X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientauthhandler.cpp;h=15efef36f31b5246d08fd3901172ee70db3c20c2;hp=415a7ddbe44010e552210e1ae16608e8da1c05f5;hb=2e9855c688c827b2159fbb548bf816de360e3ae3;hpb=d1bf207d30fe62a15d0e8669d186374c68e6eae8 diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 415a7ddb..15efef36 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -34,8 +34,6 @@ #include "clientsettings.h" #include "peerfactory.h" -#include "protocols/legacy/legacypeer.h" - using namespace Protocol; ClientAuthHandler::ClientAuthHandler(CoreAccount account, QObject *parent) @@ -180,7 +178,14 @@ void ClientAuthHandler::onSocketConnected() stream << magic; // here goes the list of protocols we support, in order of preference - stream << ((quint32)Protocol::LegacyProtocol | 0x80000000); // end list + PeerFactory::ProtoList protos = PeerFactory::supportedProtocols(); + for (int i = 0; i < protos.count(); ++i) { + quint32 reply = protos[i].first; + reply |= protos[i].second<<8; + if (i == protos.count() - 1) + reply |= 0x80000000; // end list + stream << reply; + } socket()->flush(); // make sure the probing data is sent immediately return; @@ -190,7 +195,7 @@ void ClientAuthHandler::onSocketConnected() qDebug() << "Legacy core detected, switching to compatibility mode"; - RemotePeer *peer = new LegacyPeer(this, socket(), this); + RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), 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))); @@ -246,6 +251,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)));