X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fpeer.h;h=fbc17914889f244b7ab56bd842f48a51e2bccc02;hp=32ee0b5f5eb1edcfa7842e344c3374401b8be070;hb=f353beded3963b67da6ac0878700dee8e61abfc4;hpb=9ef86f499753853c3751aee7da54d186837a5161 diff --git a/src/common/peer.h b/src/common/peer.h index 32ee0b5f..fbc17914 100644 --- a/src/common/peer.h +++ b/src/common/peer.h @@ -18,8 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef PEER_H -#define PEER_H +#pragma once #include #include @@ -27,6 +26,7 @@ #include "authhandler.h" #include "protocol.h" +#include "quassel.h" #include "signalproxy.h" class Peer : public QObject @@ -34,7 +34,7 @@ class Peer : public QObject Q_OBJECT public: - Peer(AuthHandler *authHandler, QObject *parent = 0); + explicit Peer(AuthHandler *authHandler, QObject *parent = 0); virtual Protocol::Type protocol() const = 0; virtual QString description() const = 0; @@ -42,6 +42,21 @@ public: virtual SignalProxy *signalProxy() const = 0; virtual void setSignalProxy(SignalProxy *proxy) = 0; + QDateTime connectedSince() const; + void setConnectedSince(const QDateTime &connectedSince); + + QString buildDate() const; + void setBuildDate(const QString &buildDate); + + QString clientVersion() const; + void setClientVersion(const QString &clientVersion); + + Quassel::Features features() const; + void setFeatures(Quassel::Features features); + + int id() const; + void setId(int id); + AuthHandler *authHandler() const; virtual bool isOpen() const = 0; @@ -53,12 +68,6 @@ public: virtual QString address() const = 0; virtual quint16 port() const = 0; - int _id = -1; - - QDateTime _connectedSince; - QString _buildDate; - QString _clientVersion; - public slots: /* Handshake messages */ virtual void dispatch(const Protocol::RegisterClient &) = 0; @@ -91,6 +100,14 @@ protected: private: QPointer _authHandler; + + QDateTime _connectedSince; + + QString _buildDate; + QString _clientVersion; + Quassel::Features _features; + + int _id = -1; }; // We need to special-case Peer* in attached signals/slots, so typedef it for the meta type system @@ -106,7 +123,7 @@ template inline void Peer::handle(const T &protoMessage) { switch(protoMessage.handler()) { - case Protocol::SignalProxy: + case Protocol::Handler::SignalProxy: if (!signalProxy()) { qWarning() << Q_FUNC_INFO << "Cannot handle message without a SignalProxy!"; return; @@ -114,7 +131,7 @@ void Peer::handle(const T &protoMessage) signalProxy()->handle(this, protoMessage); break; - case Protocol::AuthHandler: + case Protocol::Handler::AuthHandler: if (!authHandler()) { qWarning() << Q_FUNC_INFO << "Cannot handle auth messages without an active AuthHandler!"; return; @@ -127,5 +144,3 @@ void Peer::handle(const T &protoMessage) return; } } - -#endif