Use QSslCertificate::isNull() instead of isValid() in IdentityEditWidget
[quassel.git] / src / core / coreauthhandler.cpp
index e277fcb..9ef67fa 100644 (file)
@@ -27,8 +27,6 @@
 #include "core.h"
 #include "logger.h"
 
-#include "protocols/legacy/legacypeer.h"
-
 using namespace Protocol;
 
 CoreAuthHandler::CoreAuthHandler(QTcpSocket *socket, QObject *parent)
@@ -65,7 +63,7 @@ void CoreAuthHandler::onReadyRead()
             // no magic, assume legacy protocol
             qDebug() << "Legacy client detected, switching to compatibility mode";
             _legacy = true;
-            RemotePeer *peer = new LegacyPeer(this, socket(), this);
+            RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), Compressor::NoCompression, this);
             connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int)));
             setPeer(peer);
             return;
@@ -93,7 +91,13 @@ void CoreAuthHandler::onReadyRead()
         _supportedProtos.append(PeerFactory::ProtoDescriptor(type, protoFeatures));
 
         if (data >= 0x80000000) { // last protocol
-            RemotePeer *peer = PeerFactory::createPeer(_supportedProtos, this, socket(), this);
+            Compressor::CompressionLevel level;
+            if (_connectionFeatures & Protocol::Compression)
+                level = Compressor::BestCompression;
+            else
+                level = Compressor::NoCompression;
+
+            RemotePeer *peer = PeerFactory::createPeer(_supportedProtos, this, socket(), level, this);
             if (peer->protocol() == Protocol::LegacyProtocol) {
                 _legacy = true;
                 connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int)));
@@ -116,6 +120,8 @@ void CoreAuthHandler::onReadyRead()
 
 void CoreAuthHandler::setPeer(RemotePeer *peer)
 {
+    qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "...";
+
     _peer = peer;
     disconnect(socket(), SIGNAL(readyRead()), this, SLOT(onReadyRead()));
 }