X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fpeer.h;h=6f17ed665ebdc67f24331b894de90477e5e494d1;hb=30fa961d1aca319b52071ad9d6e4527ea2638fb7;hp=02eb3c0cde3813bb20ee4a4f1d783262b0800fae;hpb=5e6f3661d30bc760f912dfe0627e5c62c6f2c144;p=quassel.git diff --git a/src/common/peer.h b/src/common/peer.h index 02eb3c0c..6f17ed66 100644 --- a/src/common/peer.h +++ b/src/common/peer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -22,6 +22,7 @@ #define PEER_H #include +#include #include #include "authhandler.h" @@ -33,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; @@ -41,6 +42,18 @@ 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); + + int id() const; + void setId(int id); + AuthHandler *authHandler() const; virtual bool isOpen() const = 0; @@ -49,6 +62,9 @@ public: virtual int lag() const = 0; + virtual QString address() const = 0; + virtual quint16 port() const = 0; + public slots: /* Handshake messages */ virtual void dispatch(const Protocol::RegisterClient &) = 0; @@ -81,6 +97,13 @@ protected: private: QPointer _authHandler; + + QDateTime _connectedSince; + + QString _buildDate; + QString _clientVersion; + + int _id = -1; }; // We need to special-case Peer* in attached signals/slots, so typedef it for the meta type system @@ -96,7 +119,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; @@ -104,7 +127,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;