Use PeerFactory instead of creating LegacyPeer directly
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 23 Jan 2014 21:34:39 +0000 (22:34 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 23 Jan 2014 21:34:39 +0000 (22:34 +0100)
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
src/core/core.cpp
src/core/coreauthhandler.cpp
src/core/coresession.cpp

index 74bb295..6040798 100644 (file)
@@ -34,8 +34,6 @@
 #include "clientsettings.h"
 #include "peerfactory.h"
 
 #include "clientsettings.h"
 #include "peerfactory.h"
 
-#include "protocols/legacy/legacypeer.h"
-
 using namespace Protocol;
 
 ClientAuthHandler::ClientAuthHandler(CoreAccount account, QObject *parent)
 using namespace Protocol;
 
 ClientAuthHandler::ClientAuthHandler(CoreAccount account, QObject *parent)
@@ -197,7 +195,7 @@ void ClientAuthHandler::onSocketConnected()
 
     qDebug() << "Legacy core detected, switching to compatibility mode";
 
 
     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)));
 
     // 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)));
 
index 2b158ab..1d8098d 100644 (file)
@@ -32,8 +32,6 @@
 #include "sqlitestorage.h"
 #include "util.h"
 
 #include "sqlitestorage.h"
 #include "util.h"
 
-#include "protocols/legacy/legacypeer.h"
-
 // migration related
 #include <QFile>
 #ifdef Q_OS_WIN32
 // migration related
 #include <QFile>
 #ifdef Q_OS_WIN32
index e277fcb..7ca6d58 100644 (file)
@@ -27,8 +27,6 @@
 #include "core.h"
 #include "logger.h"
 
 #include "core.h"
 #include "logger.h"
 
-#include "protocols/legacy/legacypeer.h"
-
 using namespace Protocol;
 
 CoreAuthHandler::CoreAuthHandler(QTcpSocket *socket, QObject *parent)
 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;
             // 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;
             connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int)));
             setPeer(peer);
             return;
index 508e2b9..d28ddfb 100644 (file)
 #include "ircuser.h"
 #include "logger.h"
 #include "messageevent.h"
 #include "ircuser.h"
 #include "logger.h"
 #include "messageevent.h"
+#include "remotepeer.h"
 #include "storage.h"
 #include "util.h"
 
 #include "storage.h"
 #include "util.h"
 
-#include "protocols/legacy/legacypeer.h"
 
 class ProcessMessagesEvent : public QEvent
 {
 
 class ProcessMessagesEvent : public QEvent
 {