From c545a47b64dffdf3892ff4cea466b61c84d98f8f Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 23 Jan 2014 22:34:39 +0100 Subject: [PATCH] Use PeerFactory instead of creating LegacyPeer directly This means that legacypeer.h needs be included by peerfactory.cpp only, and we can remove all references to it elsewhere. --- src/client/clientauthhandler.cpp | 4 +--- src/core/core.cpp | 2 -- src/core/coreauthhandler.cpp | 4 +--- src/core/coresession.cpp | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 74bb295b..60407981 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) @@ -197,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))); diff --git a/src/core/core.cpp b/src/core/core.cpp index 2b158ab4..1d8098dd 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -32,8 +32,6 @@ #include "sqlitestorage.h" #include "util.h" -#include "protocols/legacy/legacypeer.h" - // migration related #include #ifdef Q_OS_WIN32 diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index e277fcb3..7ca6d580 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -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(), this); connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int))); setPeer(peer); return; diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 508e2b99..d28ddfba 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -44,10 +44,10 @@ #include "ircuser.h" #include "logger.h" #include "messageevent.h" +#include "remotepeer.h" #include "storage.h" #include "util.h" -#include "protocols/legacy/legacypeer.h" class ProcessMessagesEvent : public QEvent { -- 2.20.1