Rename Internal-, Remote- and LegacyConnection to -Peer
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 18 Feb 2013 22:48:00 +0000 (23:48 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 18 Feb 2013 22:48:00 +0000 (23:48 +0100)
While I'm not tooo happy with the word "Peer", I couldn't think of another one
that fits their purpose better. "Connection" was certainly less correct, and
we have so many different connections in the codebase that it got way too confusing.

At least, while Peer might not be a perfect match, it is consistent with how we always
called that in Quassel (and they still inherit from SignalProxy::AbstractPeer and have
been doing so for years!).

17 files changed:
src/client/coreconnection.cpp
src/client/coreconnection.h
src/common/CMakeLists.txt
src/common/internalpeer.cpp [moved from src/common/internalconnection.cpp with 80% similarity]
src/common/internalpeer.h [moved from src/common/internalconnection.h with 89% similarity]
src/common/protocols/legacy/legacypeer.cpp [moved from src/common/protocols/legacy/legacyconnection.cpp with 89% similarity]
src/common/protocols/legacy/legacypeer.h [moved from src/common/protocols/legacy/legacyconnection.h with 91% similarity]
src/common/remotepeer.cpp [moved from src/common/remoteconnection.cpp with 86% similarity]
src/common/remotepeer.h [moved from src/common/remoteconnection.h with 92% similarity]
src/common/signalproxy.h
src/core/core.cpp
src/core/core.h
src/core/coresession.cpp
src/core/coresession.h
src/core/sessionthread.cpp
src/core/sessionthread.h
src/qtui/monoapplication.cpp

index 8fc5c51..fb553fe 100644 (file)
 #include "clientsettings.h"
 #include "coreaccountmodel.h"
 #include "identity.h"
 #include "clientsettings.h"
 #include "coreaccountmodel.h"
 #include "identity.h"
-#include "internalconnection.h"
+#include "internalpeer.h"
 #include "network.h"
 #include "networkmodel.h"
 #include "quassel.h"
 #include "signalproxy.h"
 #include "util.h"
 
 #include "network.h"
 #include "networkmodel.h"
 #include "quassel.h"
 #include "signalproxy.h"
 #include "util.h"
 
-#include "protocols/legacy/legacyconnection.h"
+#include "protocols/legacy/legacypeer.h"
 
 CoreConnection::CoreConnection(CoreAccountModel *model, QObject *parent)
     : QObject(parent),
 
 CoreConnection::CoreConnection(CoreAccountModel *model, QObject *parent)
     : QObject(parent),
@@ -123,7 +123,7 @@ void CoreConnection::updateProgress(int value, int max)
 
 void CoreConnection::reconnectTimeout()
 {
 
 void CoreConnection::reconnectTimeout()
 {
-    if (!_connection) {
+    if (!_peer) {
         CoreConnectionSettings s;
         if (_wantReconnect && s.autoReconnect()) {
 #ifdef HAVE_KDE
         CoreConnectionSettings s;
         if (_wantReconnect && s.autoReconnect()) {
 #ifdef HAVE_KDE
@@ -201,7 +201,7 @@ void CoreConnection::solidNetworkStatusChanged(Solid::Networking::Status status)
 
 bool CoreConnection::isEncrypted() const
 {
 
 bool CoreConnection::isEncrypted() const
 {
-    return _connection && _connection->isSecure();
+    return _peer && _peer->isSecure();
 }
 
 
 }
 
 
@@ -211,7 +211,7 @@ bool CoreConnection::isLocalConnection() const
         return false;
     if (currentAccount().isInternal())
         return true;
         return false;
     if (currentAccount().isInternal())
         return true;
-    if (_connection->isLocal())
+    if (_peer->isLocal())
         return true;
 
     return false;
         return true;
 
     return false;
@@ -331,10 +331,10 @@ void CoreConnection::coreHasData(const QVariant &item)
         // if the connection is an orphan, the signalProxy adopts it.
         // -> we don't need to care about it anymore
 
         // if the connection is an orphan, the signalProxy adopts it.
         // -> we don't need to care about it anymore
 
-        disconnect(_connection, 0, this, 0);
+        disconnect(_peer, 0, this, 0);
 
 
-        _connection->setParent(0);
-        Client::signalProxy()->addPeer(_connection);
+        _peer->setParent(0);
+        Client::signalProxy()->addPeer(_peer);
 
         sessionStateReceived(msg["SessionState"].toMap());
     }
 
         sessionStateReceived(msg["SessionState"].toMap());
     }
@@ -378,15 +378,15 @@ void CoreConnection::resetConnection(bool wantReconnect)
 
     _wantReconnect = wantReconnect;
 
 
     _wantReconnect = wantReconnect;
 
-    if (_connection) {
+    if (_peer) {
         disconnect(_socket, 0, this, 0);
         disconnect(_socket, 0, this, 0);
-        disconnect(_connection, 0, this, 0);
-        _connection->close();
+        disconnect(_peer, 0, this, 0);
+        _peer->close();
 
 
-        if (_connection->parent() == this)
-            _connection->deleteLater(); // if it's not us, it belongs to the sigproxy which will delete it
+        if (_peer->parent() == this)
+            _peer->deleteLater(); // if it's not us, it belongs to the sigproxy which will delete it
         _socket = 0;      // socket is owned and will be deleted by RemoteConnection
         _socket = 0;      // socket is owned and will be deleted by RemoteConnection
-        _connection = 0;
+        _peer = 0;
     }
     else if (_socket) {
         disconnect(_socket, 0, this, 0);
     }
     else if (_socket) {
         disconnect(_socket, 0, this, 0);
@@ -475,9 +475,9 @@ void CoreConnection::connectToCurrentAccount()
         }
         emit startInternalCore();
 
         }
         emit startInternalCore();
 
-        InternalConnection *conn = new InternalConnection();
-        Client::instance()->signalProxy()->addPeer(conn); // sigproxy will take ownership
-        emit connectToInternalCore(conn);
+        InternalPeer *peer = new InternalPeer();
+        Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership
+        emit connectToInternalCore(peer);
 
         return;
     }
 
         return;
     }
@@ -525,10 +525,10 @@ void CoreConnection::connectToCurrentAccount()
 void CoreConnection::coreSocketConnected()
 {
     // Create the connection which will handle the incoming data
 void CoreConnection::coreSocketConnected()
 {
     // Create the connection which will handle the incoming data
-    Q_ASSERT(!_connection);
-    _connection = new LegacyConnection(_socket, this);
-    connect(_connection, SIGNAL(dataReceived(QVariant)), SLOT(coreHasData(QVariant)));
-    connect(_connection, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int)));
+    Q_ASSERT(!_peer);
+    _peer = new LegacyPeer(_socket, this);
+    connect(_peer, SIGNAL(dataReceived(QVariant)), SLOT(coreHasData(QVariant)));
+    connect(_peer, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int)));
 
     // Phase One: Send client info and wait for core info
 
 
     // Phase One: Send client info and wait for core info
 
@@ -546,7 +546,7 @@ void CoreConnection::coreSocketConnected()
     clientInit["UseCompression"] = false;
 #endif
 
     clientInit["UseCompression"] = false;
 #endif
 
-    qobject_cast<RemoteConnection *>(_connection)->writeSocketData(clientInit);
+    qobject_cast<RemotePeer *>(_peer)->writeSocketData(clientInit);
 }
 
 
 }
 
 
@@ -695,7 +695,7 @@ void CoreConnection::loginToCore(const QString &prevError)
     clientLogin["MsgType"] = "ClientLogin";
     clientLogin["User"] = currentAccount().user();
     clientLogin["Password"] = currentAccount().password();
     clientLogin["MsgType"] = "ClientLogin";
     clientLogin["User"] = currentAccount().user();
     clientLogin["Password"] = currentAccount().password();
-    qobject_cast<RemoteConnection*>(_connection)->writeSocketData(clientLogin);
+    qobject_cast<RemotePeer*>(_peer)->writeSocketData(clientLogin);
 }
 
 
 }
 
 
@@ -809,5 +809,5 @@ void CoreConnection::doCoreSetup(const QVariant &setupData)
     QVariantMap setup;
     setup["MsgType"] = "CoreSetupData";
     setup["SetupData"] = setupData;
     QVariantMap setup;
     setup["MsgType"] = "CoreSetupData";
     setup["SetupData"] = setupData;
-    qobject_cast<RemoteConnection *>(_connection)->writeSocketData(setup);
+    qobject_cast<RemotePeer *>(_peer)->writeSocketData(setup);
 }
 }
index f6ff7ef..836d8cc 100644 (file)
 #endif
 
 #include "coreaccount.h"
 #endif
 
 #include "coreaccount.h"
-#include "remoteconnection.h"
+#include "remotepeer.h"
 #include "types.h"
 
 class CoreAccountModel;
 #include "types.h"
 
 class CoreAccountModel;
-class InternalConnection;
+class InternalPeer;
 class Network;
 class SignalProxy;
 
 class Network;
 class SignalProxy;
 
@@ -107,7 +107,7 @@ signals:
     void coreSetupFailed(const QString &error);
 
     void startInternalCore();
     void coreSetupFailed(const QString &error);
 
     void startInternalCore();
-    void connectToInternalCore(InternalConnection *connection);
+    void connectToInternalCore(InternalPeer *connection);
 
     // These signals MUST be handled synchronously!
     void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage = QString());
 
     // These signals MUST be handled synchronously!
     void userAuthenticationRequired(CoreAccount *, bool *valid, const QString &errorMessage = QString());
@@ -176,7 +176,7 @@ private:
     QVariantMap _coreMsgBuffer;
 
     QPointer<QTcpSocket> _socket;
     QVariantMap _coreMsgBuffer;
 
     QPointer<QTcpSocket> _socket;
-    QPointer<SignalProxy::AbstractPeer> _connection;
+    QPointer<SignalProxy::AbstractPeer> _peer;
     ConnectionState _state;
 
     QTimer _reconnectTimer;
     ConnectionState _state;
 
     QTimer _reconnectTimer;
index 3043bb1..fe1d4f9 100644 (file)
@@ -17,7 +17,7 @@ set(SOURCES
     eventmanager.cpp
     identity.cpp
     ignorelistmanager.cpp
     eventmanager.cpp
     identity.cpp
     ignorelistmanager.cpp
-    internalconnection.cpp
+    internalpeer.cpp
     ircchannel.cpp
     ircevent.cpp
     irclisthelper.cpp
     ircchannel.cpp
     ircevent.cpp
     irclisthelper.cpp
@@ -29,13 +29,13 @@ set(SOURCES
     networkconfig.cpp
     networkevent.cpp
     quassel.cpp
     networkconfig.cpp
     networkevent.cpp
     quassel.cpp
-    remoteconnection.cpp
+    remotepeer.cpp
     settings.cpp
     signalproxy.cpp
     syncableobject.cpp
     util.cpp
 
     settings.cpp
     signalproxy.cpp
     syncableobject.cpp
     util.cpp
 
-    protocols/legacy/legacyconnection.cpp
+    protocols/legacy/legacypeer.cpp
 )
 
 set(MOC_HDRS
 )
 
 set(MOC_HDRS
@@ -49,18 +49,18 @@ set(MOC_HDRS
     eventmanager.h
     identity.h
     ignorelistmanager.h
     eventmanager.h
     identity.h
     ignorelistmanager.h
-    internalconnection.h
+    internalpeer.h
     ircchannel.h
     irclisthelper.h
     ircuser.h
     network.h
     networkconfig.h
     ircchannel.h
     irclisthelper.h
     ircuser.h
     network.h
     networkconfig.h
-    remoteconnection.h
+    remotepeer.h
     settings.h
     signalproxy.h
     syncableobject.h
 
     settings.h
     signalproxy.h
     syncableobject.h
 
-    protocols/legacy/legacyconnection.h
+    protocols/legacy/legacypeer.h
 )
 
 set(HEADERS ${MOC_HDRS}
 )
 
 set(HEADERS ${MOC_HDRS}
similarity index 80%
rename from src/common/internalconnection.cpp
rename to src/common/internalpeer.cpp
index 2dda138..15e67ed 100644 (file)
@@ -21,7 +21,7 @@
 #include <QCoreApplication>
 #include <QThread>
 
 #include <QCoreApplication>
 #include <QThread>
 
-#include "internalconnection.h"
+#include "internalpeer.h"
 
 using namespace Protocol;
 
 
 using namespace Protocol;
 
@@ -29,14 +29,14 @@ template<class T>
 class PeerMessageEvent : public QEvent
 {
 public:
 class PeerMessageEvent : public QEvent
 {
 public:
-    PeerMessageEvent(InternalConnection *sender, InternalConnection::EventType eventType, const T &message)
+    PeerMessageEvent(InternalPeer *sender, InternalPeer::EventType eventType, const T &message)
     : QEvent(QEvent::Type(eventType)), sender(sender), message(message) {}
     : QEvent(QEvent::Type(eventType)), sender(sender), message(message) {}
-    InternalConnection *sender;
+    InternalPeer *sender;
     T message;
 };
 
 
     T message;
 };
 
 
-InternalConnection::InternalConnection(QObject *parent)
+InternalPeer::InternalPeer(QObject *parent)
     : SignalProxy::AbstractPeer(parent),
     _proxy(0),
     _peer(0),
     : SignalProxy::AbstractPeer(parent),
     _proxy(0),
     _peer(0),
@@ -46,38 +46,38 @@ InternalConnection::InternalConnection(QObject *parent)
 }
 
 
 }
 
 
-InternalConnection::~InternalConnection()
+InternalPeer::~InternalPeer()
 {
     if (_isOpen)
         emit disconnected();
 }
 
 
 {
     if (_isOpen)
         emit disconnected();
 }
 
 
-QString InternalConnection::description() const
+QString InternalPeer::description() const
 {
     return tr("internal connection");
 }
 
 
 {
     return tr("internal connection");
 }
 
 
-bool InternalConnection::isOpen() const
+bool InternalPeer::isOpen() const
 {
     return true;
 }
 
 
 {
     return true;
 }
 
 
-bool InternalConnection::isSecure() const
+bool InternalPeer::isSecure() const
 {
     return true;
 }
 
 
 {
     return true;
 }
 
 
-bool InternalConnection::isLocal() const
+bool InternalPeer::isLocal() const
 {
     return true;
 }
 
 
 {
     return true;
 }
 
 
-void InternalConnection::close(const QString &reason)
+void InternalPeer::close(const QString &reason)
 {
     // FIXME
     Q_UNUSED(reason)
 {
     // FIXME
     Q_UNUSED(reason)
@@ -85,13 +85,13 @@ void InternalConnection::close(const QString &reason)
 }
 
 
 }
 
 
-int InternalConnection::lag() const
+int InternalPeer::lag() const
 {
     return 0;
 }
 
 
 {
     return 0;
 }
 
 
-void InternalConnection::setSignalProxy(SignalProxy *proxy)
+void InternalPeer::setSignalProxy(::SignalProxy *proxy)
 {
     if (!proxy && _proxy) {
         _proxy = 0;
 {
     if (!proxy && _proxy) {
         _proxy = 0;
@@ -111,7 +111,7 @@ void InternalConnection::setSignalProxy(SignalProxy *proxy)
 }
 
 
 }
 
 
-void InternalConnection::setPeer(InternalConnection *peer)
+void InternalPeer::setPeer(InternalPeer *peer)
 {
     if (_peer) {
         qWarning() << Q_FUNC_INFO << "Peer already set, ignoring!";
 {
     if (_peer) {
         qWarning() << Q_FUNC_INFO << "Peer already set, ignoring!";
@@ -122,7 +122,7 @@ void InternalConnection::setPeer(InternalConnection *peer)
 }
 
 
 }
 
 
-void InternalConnection::peerDisconnected()
+void InternalPeer::peerDisconnected()
 {
     disconnect(_peer, 0, this, 0);
     _peer = 0;
 {
     disconnect(_peer, 0, this, 0);
     _peer = 0;
@@ -133,32 +133,32 @@ void InternalConnection::peerDisconnected()
 }
 
 
 }
 
 
-void InternalConnection::dispatch(const SyncMessage &msg)
+void InternalPeer::dispatch(const SyncMessage &msg)
 {
     dispatch(SyncMessageEvent, msg);
 }
 
 
 {
     dispatch(SyncMessageEvent, msg);
 }
 
 
-void InternalConnection::dispatch(const RpcCall &msg)
+void InternalPeer::dispatch(const RpcCall &msg)
 {
     dispatch(RpcCallEvent, msg);
 }
 
 
 {
     dispatch(RpcCallEvent, msg);
 }
 
 
-void InternalConnection::dispatch(const InitRequest &msg)
+void InternalPeer::dispatch(const InitRequest &msg)
 {
     dispatch(InitRequestEvent, msg);
 }
 
 
 {
     dispatch(InitRequestEvent, msg);
 }
 
 
-void InternalConnection::dispatch(const InitData &msg)
+void InternalPeer::dispatch(const InitData &msg)
 {
     dispatch(InitDataEvent, msg);
 }
 
 
 template<class T>
 {
     dispatch(InitDataEvent, msg);
 }
 
 
 template<class T>
-void InternalConnection::dispatch(EventType eventType, const T &msg)
+void InternalPeer::dispatch(EventType eventType, const T &msg)
 {
     if (!_peer) {
         qWarning() << Q_FUNC_INFO << "Cannot dispatch a message without a peer!";
 {
     if (!_peer) {
         qWarning() << Q_FUNC_INFO << "Cannot dispatch a message without a peer!";
@@ -173,7 +173,7 @@ void InternalConnection::dispatch(EventType eventType, const T &msg)
 
 
 template<class T>
 
 
 template<class T>
-void InternalConnection::handle(const T &msg)
+void InternalPeer::handle(const T &msg)
 {
     if (!_proxy) {
         qWarning() << Q_FUNC_INFO << "Cannot handle a message without having a signal proxy set!";
 {
     if (!_proxy) {
         qWarning() << Q_FUNC_INFO << "Cannot handle a message without having a signal proxy set!";
@@ -184,7 +184,7 @@ void InternalConnection::handle(const T &msg)
 }
 
 
 }
 
 
-void InternalConnection::customEvent(QEvent *event)
+void InternalPeer::customEvent(QEvent *event)
 {
     switch ((int)event->type()) {
         case SyncMessageEvent: {
 {
     switch ((int)event->type()) {
         case SyncMessageEvent: {
similarity index 89%
rename from src/common/internalconnection.h
rename to src/common/internalpeer.h
index dd17f03..4c82ceb 100644 (file)
@@ -18,8 +18,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef INTERNALCONNECTION_H
-#define INTERNALCONNECTION_H
+#ifndef INTERNALPEER_H
+#define INTERNALPEER_H
 
 #include <QTcpSocket>
 
 
 #include <QTcpSocket>
 
@@ -28,7 +28,7 @@
 
 class QEvent;
 
 
 class QEvent;
 
-class InternalConnection : public SignalProxy::AbstractPeer
+class InternalPeer : public SignalProxy::AbstractPeer
 {
     Q_OBJECT
 
 {
     Q_OBJECT
 
@@ -40,16 +40,16 @@ public:
         InitDataEvent
     };
 
         InitDataEvent
     };
 
-    InternalConnection(QObject *parent = 0);
-    virtual ~InternalConnection();
+    InternalPeer(QObject *parent = 0);
+    virtual ~InternalPeer();
 
     QString description() const;
 
     SignalProxy *signalProxy() const;
     void setSignalProxy(SignalProxy *proxy);
 
 
     QString description() const;
 
     SignalProxy *signalProxy() const;
     void setSignalProxy(SignalProxy *proxy);
 
-    InternalConnection *peer() const;
-    void setPeer(InternalConnection *peer);
+    InternalPeer *peer() const;
+    void setPeer(InternalPeer *peer);
 
     bool isOpen() const;
     bool isSecure() const;
 
     bool isOpen() const;
     bool isSecure() const;
@@ -85,7 +85,7 @@ private:
 
 private:
     SignalProxy *_proxy;
 
 private:
     SignalProxy *_proxy;
-    InternalConnection *_peer;
+    InternalPeer *_peer;
     bool _isOpen;
 };
 
     bool _isOpen;
 };
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#include "legacyconnection.h"
+#include "legacypeer.h"
 
 using namespace Protocol;
 
 
 using namespace Protocol;
 
-LegacyConnection::LegacyConnection(QTcpSocket *socket, QObject *parent)
-    : RemoteConnection(socket, parent),
+LegacyPeer::LegacyPeer(QTcpSocket *socket, QObject *parent)
+    : RemotePeer(socket, parent),
     _blockSize(0),
     _useCompression(false)
 {
     _blockSize(0),
     _useCompression(false)
 {
@@ -34,9 +34,9 @@ LegacyConnection::LegacyConnection(QTcpSocket *socket, QObject *parent)
 }
 
 
 }
 
 
-void LegacyConnection::setSignalProxy(SignalProxy *proxy)
+void LegacyPeer::setSignalProxy(::SignalProxy *proxy)
 {
 {
-    RemoteConnection::setSignalProxy(proxy);
+    RemotePeer::setSignalProxy(proxy);
 
     if (proxy) {
         // enable compression now if requested - the initial handshake is uncompressed in the legacy protocol!
 
     if (proxy) {
         // enable compression now if requested - the initial handshake is uncompressed in the legacy protocol!
@@ -46,7 +46,7 @@ void LegacyConnection::setSignalProxy(SignalProxy *proxy)
 }
 
 
 }
 
 
-void LegacyConnection::socketDataAvailable()
+void LegacyPeer::socketDataAvailable()
 {
     QVariant item;
     while (readSocketData(item)) {
 {
     QVariant item;
     while (readSocketData(item)) {
@@ -59,7 +59,7 @@ void LegacyConnection::socketDataAvailable()
 }
 
 
 }
 
 
-bool LegacyConnection::readSocketData(QVariant &item)
+bool LegacyPeer::readSocketData(QVariant &item)
 {
     if (_blockSize == 0) {
         if (socket()->bytesAvailable() < 4)
 {
     if (_blockSize == 0) {
         if (socket()->bytesAvailable() < 4)
@@ -118,7 +118,7 @@ bool LegacyConnection::readSocketData(QVariant &item)
 }
 
 
 }
 
 
-void LegacyConnection::writeSocketData(const QVariant &item)
+void LegacyPeer::writeSocketData(const QVariant &item)
 {
     if (!socket()->isOpen()) {
         qWarning() << Q_FUNC_INFO << "Can't write to a closed socket!";
 {
     if (!socket()->isOpen()) {
         qWarning() << Q_FUNC_INFO << "Can't write to a closed socket!";
@@ -147,7 +147,7 @@ void LegacyConnection::writeSocketData(const QVariant &item)
 }
 
 
 }
 
 
-void LegacyConnection::handlePackedFunc(const QVariant &packedFunc)
+void LegacyPeer::handlePackedFunc(const QVariant &packedFunc)
 {
     QVariantList params(packedFunc.toList());
 
 {
     QVariantList params(packedFunc.toList());
 
@@ -228,43 +228,43 @@ void LegacyConnection::handlePackedFunc(const QVariant &packedFunc)
 }
 
 
 }
 
 
-void LegacyConnection::dispatch(const Protocol::SyncMessage &msg)
+void LegacyPeer::dispatch(const Protocol::SyncMessage &msg)
 {
     dispatchPackedFunc(QVariantList() << (qint16)Sync << msg.className() << msg.objectName() << msg.slotName() << msg.params());
 }
 
 
 {
     dispatchPackedFunc(QVariantList() << (qint16)Sync << msg.className() << msg.objectName() << msg.slotName() << msg.params());
 }
 
 
-void LegacyConnection::dispatch(const Protocol::RpcCall &msg)
+void LegacyPeer::dispatch(const Protocol::RpcCall &msg)
 {
     dispatchPackedFunc(QVariantList() << (qint16)RpcCall << msg.slotName() << msg.params());
 }
 
 
 {
     dispatchPackedFunc(QVariantList() << (qint16)RpcCall << msg.slotName() << msg.params());
 }
 
 
-void LegacyConnection::dispatch(const Protocol::InitRequest &msg)
+void LegacyPeer::dispatch(const Protocol::InitRequest &msg)
 {
     dispatchPackedFunc(QVariantList() << (qint16)InitRequest << msg.className() << msg.objectName());
 }
 
 
 {
     dispatchPackedFunc(QVariantList() << (qint16)InitRequest << msg.className() << msg.objectName());
 }
 
 
-void LegacyConnection::dispatch(const Protocol::InitData &msg)
+void LegacyPeer::dispatch(const Protocol::InitData &msg)
 {
     dispatchPackedFunc(QVariantList() << (qint16)InitData << msg.className() << msg.objectName() << msg.initData());
 }
 
 
 {
     dispatchPackedFunc(QVariantList() << (qint16)InitData << msg.className() << msg.objectName() << msg.initData());
 }
 
 
-void LegacyConnection::dispatch(const Protocol::HeartBeat &msg)
+void LegacyPeer::dispatch(const Protocol::HeartBeat &msg)
 {
     dispatchPackedFunc(QVariantList() << (qint16)HeartBeat << msg.timestamp().time());
 }
 
 
 {
     dispatchPackedFunc(QVariantList() << (qint16)HeartBeat << msg.timestamp().time());
 }
 
 
-void LegacyConnection::dispatch(const Protocol::HeartBeatReply &msg)
+void LegacyPeer::dispatch(const Protocol::HeartBeatReply &msg)
 {
     dispatchPackedFunc(QVariantList() << (qint16)HeartBeatReply << msg.timestamp().time());
 }
 
 
 {
     dispatchPackedFunc(QVariantList() << (qint16)HeartBeatReply << msg.timestamp().time());
 }
 
 
-void LegacyConnection::dispatchPackedFunc(const QVariantList &packedFunc)
+void LegacyPeer::dispatchPackedFunc(const QVariantList &packedFunc)
 {
     writeSocketData(QVariant(packedFunc));
 }
 {
     writeSocketData(QVariant(packedFunc));
 }
similarity index 91%
rename from src/common/protocols/legacy/legacyconnection.h
rename to src/common/protocols/legacy/legacypeer.h
index 04ac1c3..a3aa178 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef LEGACYCONNECTION_H
-#define LEGACYCONNECTION_H
+#ifndef LEGACYPEER_H
+#define LEGACYPEER_H
 
 #include <QDataStream>
 
 
 #include <QDataStream>
 
-#include "../../remoteconnection.h"
+#include "../../remotepeer.h"
 
 class QDataStream;
 
 
 class QDataStream;
 
-class LegacyConnection : public RemoteConnection
+class LegacyPeer : public RemotePeer
 {
     Q_OBJECT
 
 {
     Q_OBJECT
 
@@ -41,8 +41,8 @@ public:
         HeartBeatReply
     };
 
         HeartBeatReply
     };
 
-    LegacyConnection(QTcpSocket *socket, QObject *parent = 0);
-    ~LegacyConnection() {}
+    LegacyPeer(QTcpSocket *socket, QObject *parent = 0);
+    ~LegacyPeer() {}
 
     void setSignalProxy(SignalProxy *proxy);
 
 
     void setSignalProxy(SignalProxy *proxy);
 
similarity index 86%
rename from src/common/remoteconnection.cpp
rename to src/common/remotepeer.cpp
index c67d3c7..e33f56a 100644 (file)
 #  include <QSslSocket>
 #endif
 
 #  include <QSslSocket>
 #endif
 
-#include "remoteconnection.h"
+#include "remotepeer.h"
 
 using namespace Protocol;
 
 
 using namespace Protocol;
 
-RemoteConnection::RemoteConnection(QTcpSocket *socket, QObject *parent)
+RemotePeer::RemotePeer(QTcpSocket *socket, QObject *parent)
     : SignalProxy::AbstractPeer(parent),
     _socket(socket),
     _signalProxy(0),
     : SignalProxy::AbstractPeer(parent),
     _socket(socket),
     _signalProxy(0),
@@ -51,7 +51,7 @@ RemoteConnection::RemoteConnection(QTcpSocket *socket, QObject *parent)
 }
 
 
 }
 
 
-QString RemoteConnection::description() const
+QString RemotePeer::description() const
 {
     if (socket())
         return socket()->peerAddress().toString();
 {
     if (socket())
         return socket()->peerAddress().toString();
@@ -60,13 +60,13 @@ QString RemoteConnection::description() const
 }
 
 
 }
 
 
-SignalProxy *RemoteConnection::signalProxy() const
+::SignalProxy *RemotePeer::signalProxy() const
 {
     return _signalProxy;
 }
 
 
 {
     return _signalProxy;
 }
 
 
-void RemoteConnection::setSignalProxy(SignalProxy *proxy)
+void RemotePeer::setSignalProxy(::SignalProxy *proxy)
 {
     if (proxy == _signalProxy)
         return;
 {
     if (proxy == _signalProxy)
         return;
@@ -91,7 +91,7 @@ void RemoteConnection::setSignalProxy(SignalProxy *proxy)
 }
 
 
 }
 
 
-void RemoteConnection::changeHeartBeatInterval(int secs)
+void RemotePeer::changeHeartBeatInterval(int secs)
 {
     if(secs <= 0)
         _heartBeatTimer->stop();
 {
     if(secs <= 0)
         _heartBeatTimer->stop();
@@ -102,19 +102,19 @@ void RemoteConnection::changeHeartBeatInterval(int secs)
 }
 
 
 }
 
 
-int RemoteConnection::lag() const
+int RemotePeer::lag() const
 {
     return _lag;
 }
 
 
 {
     return _lag;
 }
 
 
-QTcpSocket *RemoteConnection::socket() const
+QTcpSocket *RemotePeer::socket() const
 {
     return _socket;
 }
 
 
 {
     return _socket;
 }
 
 
-bool RemoteConnection::isSecure() const
+bool RemotePeer::isSecure() const
 {
     if (socket()) {
         if (isLocal())
 {
     if (socket()) {
         if (isLocal())
@@ -129,7 +129,7 @@ bool RemoteConnection::isSecure() const
 }
 
 
 }
 
 
-bool RemoteConnection::isLocal() const
+bool RemotePeer::isLocal() const
 {
     if (socket()) {
         if (socket()->peerAddress() == QHostAddress::LocalHost || socket()->peerAddress() == QHostAddress::LocalHostIPv6)
 {
     if (socket()) {
         if (socket()->peerAddress() == QHostAddress::LocalHost || socket()->peerAddress() == QHostAddress::LocalHostIPv6)
@@ -139,13 +139,13 @@ bool RemoteConnection::isLocal() const
 }
 
 
 }
 
 
-bool RemoteConnection::isOpen() const
+bool RemotePeer::isOpen() const
 {
     return socket() && socket()->state() == QTcpSocket::ConnectedState;
 }
 
 
 {
     return socket() && socket()->state() == QTcpSocket::ConnectedState;
 }
 
 
-void RemoteConnection::close(const QString &reason)
+void RemotePeer::close(const QString &reason)
 {
     if (!reason.isEmpty()) {
         qWarning() << "Disconnecting:" << reason;
 {
     if (!reason.isEmpty()) {
         qWarning() << "Disconnecting:" << reason;
@@ -157,13 +157,13 @@ void RemoteConnection::close(const QString &reason)
 }
 
 
 }
 
 
-void RemoteConnection::handle(const HeartBeat &heartBeat)
+void RemotePeer::handle(const HeartBeat &heartBeat)
 {
     dispatch(HeartBeatReply(heartBeat.timestamp()));
 }
 
 
 {
     dispatch(HeartBeatReply(heartBeat.timestamp()));
 }
 
 
-void RemoteConnection::handle(const HeartBeatReply &heartBeatReply)
+void RemotePeer::handle(const HeartBeatReply &heartBeatReply)
 {
     _heartBeatCount = 0;
 #if QT_VERSION < 0x040700
 {
     _heartBeatCount = 0;
 #if QT_VERSION < 0x040700
@@ -174,7 +174,7 @@ void RemoteConnection::handle(const HeartBeatReply &heartBeatReply)
 }
 
 
 }
 
 
-void RemoteConnection::sendHeartBeat()
+void RemotePeer::sendHeartBeat()
 {
     if (signalProxy()->maxHeartBeatCount() > 0 && _heartBeatCount >= signalProxy()->maxHeartBeatCount()) {
         qWarning() << "Disconnecting peer:" << description()
 {
     if (signalProxy()->maxHeartBeatCount() > 0 && _heartBeatCount >= signalProxy()->maxHeartBeatCount()) {
         qWarning() << "Disconnecting peer:" << description()
similarity index 92%
rename from src/common/remoteconnection.h
rename to src/common/remotepeer.h
index 6d12d70..e41a6a3 100644 (file)
@@ -18,8 +18,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef REMOTECONNECTION_H
-#define REMOTECONNECTION_H
+#ifndef REMOTEPEER_H
+#define REMOTEPEER_H
 
 #include <QDateTime>
 #include <QTcpSocket>
 
 #include <QDateTime>
 #include <QTcpSocket>
 
 class QTimer;
 
 
 class QTimer;
 
-class RemoteConnection : public SignalProxy::AbstractPeer
+class RemotePeer : public SignalProxy::AbstractPeer
 {
     Q_OBJECT
 
 public:
 {
     Q_OBJECT
 
 public:
-    RemoteConnection(QTcpSocket *socket, QObject *parent = 0);
-    virtual ~RemoteConnection() {};
+    RemotePeer(QTcpSocket *socket, QObject *parent = 0);
+    virtual ~RemotePeer() {};
 
     void setSignalProxy(SignalProxy *proxy);
 
 
     void setSignalProxy(SignalProxy *proxy);
 
@@ -91,10 +91,9 @@ private:
     int _lag;
 };
 
     int _lag;
 };
 
-
 // Template methods we need in the header
 template<class T> inline
 // Template methods we need in the header
 template<class T> inline
-void RemoteConnection::handle(const T &protoMessage)
+void RemotePeer::handle(const T &protoMessage)
 {
     if (!signalProxy()) {
         qWarning() << Q_FUNC_INFO << "Cannot handle messages without a SignalProxy!";
 {
     if (!signalProxy()) {
         qWarning() << Q_FUNC_INFO << "Cannot handle messages without a SignalProxy!";
index 7f70f7e..d446fef 100644 (file)
@@ -168,8 +168,8 @@ private:
 
     friend class SignalRelay;
     friend class SyncableObject;
 
     friend class SignalRelay;
     friend class SyncableObject;
-    friend class InternalConnection;
-    friend class RemoteConnection;
+    friend class InternalPeer;
+    friend class RemotePeer;
 };
 
 
 };
 
 
index e7c56e5..4413211 100644 (file)
 #include "core.h"
 #include "coresession.h"
 #include "coresettings.h"
 #include "core.h"
 #include "coresession.h"
 #include "coresettings.h"
-#include "internalconnection.h"
+#include "internalpeer.h"
 #include "postgresqlstorage.h"
 #include "quassel.h"
 #include "postgresqlstorage.h"
 #include "quassel.h"
-#include "signalproxy.h"
 #include "sqlitestorage.h"
 #include "network.h"
 #include "logger.h"
 
 #include "util.h"
 
 #include "sqlitestorage.h"
 #include "network.h"
 #include "logger.h"
 
 #include "util.h"
 
-#include "protocols/legacy/legacyconnection.h"
+#include "protocols/legacy/legacypeer.h"
 
 // migration related
 #include <QFile>
 
 // migration related
 #include <QFile>
@@ -57,8 +56,8 @@ const int Core::AddClientEventId = QEvent::registerEventType();
 class AddClientEvent : public QEvent
 {
 public:
 class AddClientEvent : public QEvent
 {
 public:
-    AddClientEvent(RemoteConnection *connection, UserId uid) : QEvent(QEvent::Type(Core::AddClientEventId)), connection(connection), userId(uid) {}
-    RemoteConnection *connection;
+    AddClientEvent(RemotePeer *p, UserId uid) : QEvent(QEvent::Type(Core::AddClientEventId)), peer(p), userId(uid) {}
+    RemotePeer *peer;
     UserId userId;
 };
 
     UserId userId;
 };
 
@@ -218,8 +217,8 @@ void Core::init()
 
 Core::~Core()
 {
 
 Core::~Core()
 {
-    foreach(RemoteConnection *connection, clientInfo.keys()) {
-        connection->close(); // disconnect non authed clients
+    foreach(RemotePeer *peer, clientInfo.keys()) {
+        peer->close(); // disconnect non authed clients
     }
     qDeleteAll(sessions);
     qDeleteAll(_storageBackends);
     }
     qDeleteAll(sessions);
     qDeleteAll(_storageBackends);
@@ -518,13 +517,13 @@ void Core::incomingConnection()
     Q_ASSERT(server);
     while (server->hasPendingConnections()) {
         QTcpSocket *socket = server->nextPendingConnection();
     Q_ASSERT(server);
     while (server->hasPendingConnections()) {
         QTcpSocket *socket = server->nextPendingConnection();
-        RemoteConnection *connection = new LegacyConnection(socket, this);
+        RemotePeer *peer = new LegacyPeer(socket, this);
 
 
-        connect(connection, SIGNAL(disconnected()), SLOT(clientDisconnected()));
-        connect(connection, SIGNAL(dataReceived(QVariant)), SLOT(processClientMessage(QVariant)));
-        connect(connection, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
+        connect(peer, SIGNAL(disconnected()), SLOT(clientDisconnected()));
+        connect(peer, SIGNAL(dataReceived(QVariant)), SLOT(processClientMessage(QVariant)));
+        connect(peer, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
 
 
-        clientInfo.insert(connection, QVariantMap());
+        clientInfo.insert(peer, QVariantMap());
         quInfo() << qPrintable(tr("Client connected from"))  << qPrintable(socket->peerAddress().toString());
 
         if (!_configured) {
         quInfo() << qPrintable(tr("Client connected from"))  << qPrintable(socket->peerAddress().toString());
 
         if (!_configured) {
@@ -536,8 +535,8 @@ void Core::incomingConnection()
 
 void Core::processClientMessage(const QVariant &data)
 {
 
 void Core::processClientMessage(const QVariant &data)
 {
-    RemoteConnection *connection = qobject_cast<RemoteConnection *>(sender());
-    if (!connection) {
+    RemotePeer *peer = qobject_cast<RemotePeer *>(sender());
+    if (!peer) {
         qWarning() << Q_FUNC_INFO << "Message not sent by RemoteConnection!";
         return;
     }
         qWarning() << Q_FUNC_INFO << "Message not sent by RemoteConnection!";
         return;
     }
@@ -546,7 +545,7 @@ void Core::processClientMessage(const QVariant &data)
     if (!msg.contains("MsgType")) {
         // Client is way too old, does not even use the current init format
         qWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
     if (!msg.contains("MsgType")) {
         // Client is way too old, does not even use the current init format
         qWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
-        connection->close();
+        peer->close();
         return;
     }
 
         return;
     }
 
@@ -561,9 +560,9 @@ void Core::processClientMessage(const QVariant &data)
             reply["Error"] = tr("<b>Your Quassel Client is too old!</b><br>"
                                 "This core needs at least client/core protocol version %1.<br>"
                                 "Please consider upgrading your client.").arg(Quassel::buildInfo().coreNeedsProtocol);
             reply["Error"] = tr("<b>Your Quassel Client is too old!</b><br>"
                                 "This core needs at least client/core protocol version %1.<br>"
                                 "Please consider upgrading your client.").arg(Quassel::buildInfo().coreNeedsProtocol);
-            connection->writeSocketData(reply);
-            qWarning() << qPrintable(tr("Client")) << connection->description() << qPrintable(tr("too old, rejecting."));
-            connection->close();
+            peer->writeSocketData(reply);
+            qWarning() << qPrintable(tr("Client")) << peer->description() << qPrintable(tr("too old, rejecting."));
+            peer->close();
             return;
         }
 
             return;
         }
 
@@ -590,7 +589,7 @@ void Core::processClientMessage(const QVariant &data)
 
 #ifdef HAVE_SSL
         SslServer *sslServer = qobject_cast<SslServer *>(&_server);
 
 #ifdef HAVE_SSL
         SslServer *sslServer = qobject_cast<SslServer *>(&_server);
-        QSslSocket *sslSocket = qobject_cast<QSslSocket *>(connection->socket());
+        QSslSocket *sslSocket = qobject_cast<QSslSocket *>(peer->socket());
         bool supportSsl = sslServer && sslSocket && sslServer->isCertValid();
 #else
         bool supportSsl = false;
         bool supportSsl = sslServer && sslSocket && sslServer->isCertValid();
 #else
         bool supportSsl = false;
@@ -626,15 +625,15 @@ void Core::processClientMessage(const QVariant &data)
         else {
             reply["Configured"] = true;
         }
         else {
             reply["Configured"] = true;
         }
-        clientInfo[connection] = msg; // store for future reference
+        clientInfo[peer] = msg; // store for future reference
         reply["MsgType"] = "ClientInitAck";
         reply["MsgType"] = "ClientInitAck";
-        connection->writeSocketData(reply);
-        connection->socket()->flush(); // ensure that the write cache is flushed before we switch to ssl
+        peer->writeSocketData(reply);
+        peer->socket()->flush(); // ensure that the write cache is flushed before we switch to ssl
 
 #ifdef HAVE_SSL
         // after we told the client that we are ssl capable we switch to ssl mode
         if (supportSsl && msg["UseSsl"].toBool()) {
 
 #ifdef HAVE_SSL
         // after we told the client that we are ssl capable we switch to ssl mode
         if (supportSsl && msg["UseSsl"].toBool()) {
-            qDebug() << qPrintable(tr("Starting TLS for Client:"))  << connection->description();
+            qDebug() << qPrintable(tr("Starting TLS for Client:"))  << peer->description();
             connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), SLOT(sslErrors(const QList<QSslError> &)));
             sslSocket->startServerEncryption();
         }
             connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), SLOT(sslErrors(const QList<QSslError> &)));
             sslSocket->startServerEncryption();
         }
@@ -642,20 +641,20 @@ void Core::processClientMessage(const QVariant &data)
 
 #ifndef QT_NO_COMPRESS
         if (supportsCompression && msg["UseCompression"].toBool()) {
 
 #ifndef QT_NO_COMPRESS
         if (supportsCompression && msg["UseCompression"].toBool()) {
-            connection->socket()->setProperty("UseCompression", true);
-            qDebug() << "Using compression for Client:" << qPrintable(connection->socket()->peerAddress().toString());
+            peer->socket()->setProperty("UseCompression", true);
+            qDebug() << "Using compression for Client:" << qPrintable(peer->socket()->peerAddress().toString());
         }
 #endif
     }
     else {
         // for the rest, we need an initialized connection
         }
 #endif
     }
     else {
         // for the rest, we need an initialized connection
-        if (!clientInfo.contains(connection)) {
+        if (!clientInfo.contains(peer)) {
             QVariantMap reply;
             reply["MsgType"] = "ClientLoginReject";
             reply["Error"] = tr("<b>Client not initialized!</b><br>You need to send an init message before trying to login.");
             QVariantMap reply;
             reply["MsgType"] = "ClientLoginReject";
             reply["Error"] = tr("<b>Client not initialized!</b><br>You need to send an init message before trying to login.");
-            connection->writeSocketData(reply);
-            qWarning() << qPrintable(tr("Client")) << qPrintable(connection->socket()->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
-            connection->close(); return;
+            peer->writeSocketData(reply);
+            qWarning() << qPrintable(tr("Client")) << qPrintable(peer->socket()->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
+            peer->close(); return;
         }
         if (msg["MsgType"] == "CoreSetupData") {
             QVariantMap reply;
         }
         if (msg["MsgType"] == "CoreSetupData") {
             QVariantMap reply;
@@ -667,7 +666,7 @@ void Core::processClientMessage(const QVariant &data)
             else {
                 reply["MsgType"] = "CoreSetupAck";
             }
             else {
                 reply["MsgType"] = "CoreSetupAck";
             }
-            connection->writeSocketData(reply);
+            peer->writeSocketData(reply);
         }
         else if (msg["MsgType"] == "ClientLogin") {
             QVariantMap reply;
         }
         else if (msg["MsgType"] == "ClientLogin") {
             QVariantMap reply;
@@ -675,13 +674,13 @@ void Core::processClientMessage(const QVariant &data)
             if (uid == 0) {
                 reply["MsgType"] = "ClientLoginReject";
                 reply["Error"] = tr("<b>Invalid username or password!</b><br>The username/password combination you supplied could not be found in the database.");
             if (uid == 0) {
                 reply["MsgType"] = "ClientLoginReject";
                 reply["Error"] = tr("<b>Invalid username or password!</b><br>The username/password combination you supplied could not be found in the database.");
-                connection->writeSocketData(reply);
+                peer->writeSocketData(reply);
                 return;
             }
             reply["MsgType"] = "ClientLoginAck";
                 return;
             }
             reply["MsgType"] = "ClientLoginAck";
-            connection->writeSocketData(reply);
-            quInfo() << qPrintable(tr("Client")) << qPrintable(connection->socket()->peerAddress().toString()) << qPrintable(tr("initialized and authenticated successfully as \"%1\" (UserId: %2).").arg(msg["User"].toString()).arg(uid.toInt()));
-            setupClientSession(connection, uid);
+            peer->writeSocketData(reply);
+            quInfo() << qPrintable(tr("Client")) << qPrintable(peer->socket()->peerAddress().toString()) << qPrintable(tr("initialized and authenticated successfully as \"%1\" (UserId: %2).").arg(msg["User"].toString()).arg(uid.toInt()));
+            setupClientSession(peer, uid);
         }
     }
 }
         }
     }
 }
@@ -690,12 +689,12 @@ void Core::processClientMessage(const QVariant &data)
 // Potentially called during the initialization phase (before handing the connection off to the session)
 void Core::clientDisconnected()
 {
 // Potentially called during the initialization phase (before handing the connection off to the session)
 void Core::clientDisconnected()
 {
-    RemoteConnection *connection = qobject_cast<RemoteConnection *>(sender());
-    Q_ASSERT(connection);
+    RemotePeer *peer = qobject_cast<RemotePeer *>(sender());
+    Q_ASSERT(peer);
 
 
-    quInfo() << qPrintable(tr("Non-authed client disconnected.")) << qPrintable(connection->socket()->peerAddress().toString());
-    clientInfo.remove(connection);
-    connection->deleteLater();
+    quInfo() << qPrintable(tr("Non-authed client disconnected.")) << qPrintable(peer->socket()->peerAddress().toString());
+    clientInfo.remove(peer);
+    peer->deleteLater();
 
     // make server listen again if still not configured
     if (!_configured) {
 
     // make server listen again if still not configured
     if (!_configured) {
@@ -707,12 +706,12 @@ void Core::clientDisconnected()
 }
 
 
 }
 
 
-void Core::setupClientSession(RemoteConnection *connection, UserId uid)
+void Core::setupClientSession(RemotePeer *peer, UserId uid)
 {
     // From now on everything is handled by the client session
 {
     // From now on everything is handled by the client session
-    disconnect(connection, 0, this, 0);
-    connection->socket()->flush();
-    clientInfo.remove(connection);
+    disconnect(peer, 0, this, 0);
+    peer->socket()->flush();
+    clientInfo.remove(peer);
 
     // Find or create session for validated user
     SessionThread *session;
 
     // Find or create session for validated user
     SessionThread *session;
@@ -722,15 +721,15 @@ void Core::setupClientSession(RemoteConnection *connection, UserId uid)
     else {
         session = createSession(uid);
         if (!session) {
     else {
         session = createSession(uid);
         if (!session) {
-            qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(connection->socket()->peerAddress().toString());
-            connection->close();
+            qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(peer->socket()->peerAddress().toString());
+            peer->close();
             return;
         }
     }
 
     // as we are currently handling an event triggered by incoming data on this socket
     // it is unsafe to directly move the socket to the client thread.
             return;
         }
     }
 
     // as we are currently handling an event triggered by incoming data on this socket
     // it is unsafe to directly move the socket to the client thread.
-    QCoreApplication::postEvent(this, new AddClientEvent(connection, uid));
+    QCoreApplication::postEvent(this, new AddClientEvent(peer, uid));
 }
 
 
 }
 
 
@@ -738,27 +737,27 @@ void Core::customEvent(QEvent *event)
 {
     if (event->type() == AddClientEventId) {
         AddClientEvent *addClientEvent = static_cast<AddClientEvent *>(event);
 {
     if (event->type() == AddClientEventId) {
         AddClientEvent *addClientEvent = static_cast<AddClientEvent *>(event);
-        addClientHelper(addClientEvent->connection, addClientEvent->userId);
+        addClientHelper(addClientEvent->peer, addClientEvent->userId);
         return;
     }
 }
 
 
         return;
     }
 }
 
 
-void Core::addClientHelper(RemoteConnection *connection, UserId uid)
+void Core::addClientHelper(RemotePeer *peer, UserId uid)
 {
     // Find or create session for validated user
     if (!sessions.contains(uid)) {
 {
     // Find or create session for validated user
     if (!sessions.contains(uid)) {
-        qWarning() << qPrintable(tr("Could not find a session for client:")) << qPrintable(connection->socket()->peerAddress().toString());
-        connection->close();
+        qWarning() << qPrintable(tr("Could not find a session for client:")) << qPrintable(peer->socket()->peerAddress().toString());
+        peer->close();
         return;
     }
 
     SessionThread *session = sessions[uid];
         return;
     }
 
     SessionThread *session = sessions[uid];
-    session->addClient(connection);
+    session->addClient(peer);
 }
 
 
 }
 
 
-void Core::setupInternalClientSession(InternalConnection *clientConnection)
+void Core::setupInternalClientSession(InternalPeer *clientPeer)
 {
     if (!_configured) {
         stopListening();
 {
     if (!_configured) {
         stopListening();
@@ -774,9 +773,9 @@ void Core::setupInternalClientSession(InternalConnection *clientConnection)
         return;
     }
 
         return;
     }
 
-    InternalConnection *coreConnection = new InternalConnection(this);
-    coreConnection->setPeer(clientConnection);
-    clientConnection->setPeer(coreConnection);
+    InternalPeer *corePeer = new InternalPeer(this);
+    corePeer->setPeer(clientPeer);
+    clientPeer->setPeer(corePeer);
 
     // Find or create session for validated user
     SessionThread *sessionThread;
 
     // Find or create session for validated user
     SessionThread *sessionThread;
@@ -785,7 +784,7 @@ void Core::setupInternalClientSession(InternalConnection *clientConnection)
     else
         sessionThread = createSession(uid);
 
     else
         sessionThread = createSession(uid);
 
-    sessionThread->addClient(coreConnection);
+    sessionThread->addClient(corePeer);
 }
 
 
 }
 
 
@@ -816,9 +815,9 @@ void Core::sslErrors(const QList<QSslError> &errors)
 
 void Core::socketError(QAbstractSocket::SocketError err)
 {
 
 void Core::socketError(QAbstractSocket::SocketError err)
 {
-    RemoteConnection *connection = qobject_cast<RemoteConnection *>(sender());
-    if (connection && err != QAbstractSocket::RemoteHostClosedError)
-        qWarning() << "Core::socketError()" << connection->socket() << err << connection->socket()->errorString();
+    RemotePeer *peer = qobject_cast<RemotePeer *>(sender());
+    if (peer && err != QAbstractSocket::RemoteHostClosedError)
+        qWarning() << "Core::socketError()" << peer->socket() << err << peer->socket()->errorString();
 }
 
 
 }
 
 
index dfecbe0..ebe8061 100644 (file)
@@ -42,7 +42,7 @@
 #include "types.h"
 
 class CoreSession;
 #include "types.h"
 
 class CoreSession;
-class RemoteConnection;
+class RemotePeer;
 struct NetworkInfo;
 class SessionThread;
 class SignalProxy;
 struct NetworkInfo;
 class SessionThread;
 class SignalProxy;
@@ -485,7 +485,7 @@ public slots:
     /** \note This method is threadsafe.
      */
     void syncStorage();
     /** \note This method is threadsafe.
      */
     void syncStorage();
-    void setupInternalClientSession(InternalConnection *clientConnection);
+    void setupInternalClientSession(InternalPeer *clientConnection);
 
 signals:
     //! Sent when a BufferInfo is updated in storage.
 
 signals:
     //! Sent when a BufferInfo is updated in storage.
@@ -520,8 +520,8 @@ private:
     static Core *instanceptr;
 
     SessionThread *createSession(UserId userId, bool restoreState = false);
     static Core *instanceptr;
 
     SessionThread *createSession(UserId userId, bool restoreState = false);
-    void setupClientSession(RemoteConnection *connection, UserId uid);
-    void addClientHelper(RemoteConnection *connection, UserId uid);
+    void setupClientSession(RemotePeer *peer, UserId uid);
+    void addClientHelper(RemotePeer *peer, UserId uid);
     //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
     QString setupCoreForInternalUsage();
     QString setupCore(QVariantMap setupData);
     //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
     QString setupCoreForInternalUsage();
     QString setupCore(QVariantMap setupData);
@@ -548,7 +548,7 @@ private:
 
     OidentdConfigGenerator *_oidentdConfigGenerator;
 
 
     OidentdConfigGenerator *_oidentdConfigGenerator;
 
-    QHash<RemoteConnection *, QVariantMap> clientInfo;
+    QHash<RemotePeer *, QVariantMap> clientInfo;
 
     QHash<QString, Storage *> _storageBackends;
 
 
     QHash<QString, Storage *> _storageBackends;
 
index fb0aad8..d44cf2b 100644 (file)
@@ -37,7 +37,7 @@
 #include "coreusersettings.h"
 #include "ctcpparser.h"
 #include "eventstringifier.h"
 #include "coreusersettings.h"
 #include "ctcpparser.h"
 #include "eventstringifier.h"
-#include "internalconnection.h"
+#include "internalpeer.h"
 #include "ircchannel.h"
 #include "ircparser.h"
 #include "ircuser.h"
 #include "ircchannel.h"
 #include "ircparser.h"
 #include "ircuser.h"
@@ -46,7 +46,7 @@
 #include "storage.h"
 #include "util.h"
 
 #include "storage.h"
 #include "util.h"
 
-#include "protocols/legacy/legacyconnection.h"
+#include "protocols/legacy/legacypeer.h"
 
 class ProcessMessagesEvent : public QEvent
 {
 
 class ProcessMessagesEvent : public QEvent
 {
@@ -206,28 +206,28 @@ void CoreSession::restoreSessionState()
 }
 
 
 }
 
 
-void CoreSession::addClient(RemoteConnection *connection)
+void CoreSession::addClient(RemotePeer *peer)
 {
     QVariantMap reply;
     reply["MsgType"] = "SessionInit";
     reply["SessionState"] = sessionState();
 {
     QVariantMap reply;
     reply["MsgType"] = "SessionInit";
     reply["SessionState"] = sessionState();
-    connection->writeSocketData(reply);
-    signalProxy()->addPeer(connection);
+    peer->writeSocketData(reply);
+    signalProxy()->addPeer(peer);
 }
 
 
 }
 
 
-void CoreSession::addClient(InternalConnection *connection)
+void CoreSession::addClient(InternalPeer *peer)
 {
 {
-    signalProxy()->addPeer(connection);
+    signalProxy()->addPeer(peer);
     emit sessionState(sessionState());
 }
 
 
 void CoreSession::removeClient(SignalProxy::AbstractPeer *peer)
 {
     emit sessionState(sessionState());
 }
 
 
 void CoreSession::removeClient(SignalProxy::AbstractPeer *peer)
 {
-    RemoteConnection *connection = qobject_cast<RemoteConnection *>(peer);
-    if (connection)
-        quInfo() << qPrintable(tr("Client")) << connection->description() << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt()));
+    RemotePeer *p = qobject_cast<RemotePeer *>(peer);
+    if (p)
+        quInfo() << qPrintable(tr("Client")) << p->description() << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt()));
 }
 
 
 }
 
 
index b104631..fdb952f 100644 (file)
@@ -42,11 +42,11 @@ class CoreSessionEventProcessor;
 class CtcpParser;
 class EventManager;
 class EventStringifier;
 class CtcpParser;
 class EventManager;
 class EventStringifier;
-class InternalConnection;
+class InternalPeer;
 class IrcParser;
 class MessageEvent;
 class NetworkConnection;
 class IrcParser;
 class MessageEvent;
 class NetworkConnection;
-class RemoteConnection;
+class RemotePeer;
 
 struct NetworkInfo;
 
 
 struct NetworkInfo;
 
@@ -89,8 +89,8 @@ public:
     void restoreSessionState();
 
 public slots:
     void restoreSessionState();
 
 public slots:
-    void addClient(RemoteConnection *connection);
-    void addClient(InternalConnection *connection);
+    void addClient(RemotePeer *peer);
+    void addClient(InternalPeer *peer);
 
     void msgFromClient(BufferInfo, QString message);
 
 
     void msgFromClient(BufferInfo, QString message);
 
index 24cba31..e886db5 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "core.h"
 #include "coresession.h"
 
 #include "core.h"
 #include "coresession.h"
-#include "internalconnection.h"
-#include "remoteconnection.h"
+#include "internalpeer.h"
+#include "remotepeer.h"
 #include "sessionthread.h"
 #include "signalproxy.h"
 
 #include "sessionthread.h"
 #include "signalproxy.h"
 
@@ -86,13 +86,13 @@ void SessionThread::addClient(QObject *peer)
 
 void SessionThread::addClientToSession(QObject *peer)
 {
 
 void SessionThread::addClientToSession(QObject *peer)
 {
-    RemoteConnection *connection = qobject_cast<RemoteConnection *>(peer);
-    if (connection) {
-        addRemoteClientToSession(connection);
+    RemotePeer *remote = qobject_cast<RemotePeer *>(peer);
+    if (remote) {
+        addRemoteClientToSession(remote);
         return;
     }
 
         return;
     }
 
-    InternalConnection *internal = qobject_cast<InternalConnection *>(peer);
+    InternalPeer *internal = qobject_cast<InternalPeer *>(peer);
     if (internal) {
         addInternalClientToSession(internal);
         return;
     if (internal) {
         addInternalClientToSession(internal);
         return;
@@ -102,27 +102,27 @@ void SessionThread::addClientToSession(QObject *peer)
 }
 
 
 }
 
 
-void SessionThread::addRemoteClientToSession(RemoteConnection *connection)
+void SessionThread::addRemoteClientToSession(RemotePeer *remotePeer)
 {
 {
-    connection->setParent(0);
-    connection->moveToThread(session()->thread());
-    emit addRemoteClient(connection);
+    remotePeer->setParent(0);
+    remotePeer->moveToThread(session()->thread());
+    emit addRemoteClient(remotePeer);
 }
 
 
 }
 
 
-void SessionThread::addInternalClientToSession(InternalConnection *connection)
+void SessionThread::addInternalClientToSession(InternalPeer *internalPeer)
 {
 {
-    connection->setParent(0);
-    connection->moveToThread(session()->thread());
-    emit addInternalClient(connection);
+    internalPeer->setParent(0);
+    internalPeer->moveToThread(session()->thread());
+    emit addInternalClient(internalPeer);
 }
 
 
 void SessionThread::run()
 {
     _session = new CoreSession(user(), _restoreState);
 }
 
 
 void SessionThread::run()
 {
     _session = new CoreSession(user(), _restoreState);
-    connect(this, SIGNAL(addRemoteClient(RemoteConnection*)), _session, SLOT(addClient(RemoteConnection*)));
-    connect(this, SIGNAL(addInternalClient(InternalConnection*)), _session, SLOT(addClient(InternalConnection*)));
+    connect(this, SIGNAL(addRemoteClient(RemotePeer*)), _session, SLOT(addClient(RemotePeer*)));
+    connect(this, SIGNAL(addInternalClient(InternalPeer*)), _session, SLOT(addClient(InternalPeer*)));
     connect(_session, SIGNAL(sessionState(QVariant)), Core::instance(), SIGNAL(sessionState(QVariant)));
     emit initialized();
     exec();
     connect(_session, SIGNAL(sessionState(QVariant)), Core::instance(), SIGNAL(sessionState(QVariant)));
     emit initialized();
     exec();
index 9639f68..b36b243 100644 (file)
@@ -27,8 +27,8 @@
 #include "types.h"
 
 class CoreSession;
 #include "types.h"
 
 class CoreSession;
-class InternalConnection;
-class RemoteConnection;
+class InternalPeer;
+class RemotePeer;
 class QIODevice;
 
 class SessionThread : public QThread
 class QIODevice;
 
 class SessionThread : public QThread
@@ -54,8 +54,8 @@ signals:
     void initialized();
     void shutdown();
 
     void initialized();
     void shutdown();
 
-    void addRemoteClient(RemoteConnection *);
-    void addInternalClient(InternalConnection *);
+    void addRemoteClient(RemotePeer *peer);
+    void addInternalClient(InternalPeer *peer);
 
 private:
     CoreSession *_session;
 
 private:
     CoreSession *_session;
@@ -66,8 +66,8 @@ private:
 
     bool isSessionInitialized();
     void addClientToSession(QObject *peer);
 
     bool isSessionInitialized();
     void addClientToSession(QObject *peer);
-    void addRemoteClientToSession(RemoteConnection *connection);
-    void addInternalClientToSession(InternalConnection *client);
+    void addRemoteClientToSession(RemotePeer *remotePeer);
+    void addInternalClientToSession(InternalPeer *internalPeer);
 };
 
 
 };
 
 
index 67bee8e..69ca448 100644 (file)
@@ -24,7 +24,7 @@
 #include "core.h"
 #include "qtui.h"
 
 #include "core.h"
 #include "qtui.h"
 
-class InternalConnection;
+class InternalPeer;
 
 MonolithicApplication::MonolithicApplication(int &argc, char **argv)
     : QtUiApplication(argc, argv),
 
 MonolithicApplication::MonolithicApplication(int &argc, char **argv)
     : QtUiApplication(argc, argv),
@@ -70,6 +70,6 @@ void MonolithicApplication::startInternalCore()
     }
     Core *core = Core::instance();
     CoreConnection *connection = Client::coreConnection();
     }
     Core *core = Core::instance();
     CoreConnection *connection = Client::coreConnection();
-    connect(connection, SIGNAL(connectToInternalCore(InternalConnection*)), core, SLOT(setupInternalClientSession(InternalConnection*)));
+    connect(connection, SIGNAL(connectToInternalCore(InternalPeer*)), core, SLOT(setupInternalClientSession(InternalPeer*)));
     connect(core, SIGNAL(sessionState(QVariant)), connection, SLOT(internalSessionStateReceived(QVariant)));
 }
     connect(core, SIGNAL(sessionState(QVariant)), connection, SLOT(internalSessionStateReceived(QVariant)));
 }