X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fpeer.h;h=c77c6bfa297505d90441f1181f5ca7a675e34115;hp=79204b4f9996a33b2e4cf312ef1eed2f7e1c3caf;hb=8196302f8aa6e97dcfafe9d0008ac9c7366d89da;hpb=d98cc721477645abcb5387313f3ad2c96a580ad6 diff --git a/src/common/peer.h b/src/common/peer.h index 79204b4f..c77c6bfa 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-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -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,22 @@ 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); + + bool hasFeature(Quassel::Feature feature) const; + Quassel::Features features() const; + void setFeatures(Quassel::Features features); + + int id() const; + void setId(int id); + AuthHandler *authHandler() const; virtual bool isOpen() const = 0; @@ -50,6 +66,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; @@ -82,6 +101,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 @@ -97,7 +124,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; @@ -105,7 +132,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; @@ -118,5 +145,3 @@ void Peer::handle(const T &protoMessage) return; } } - -#endif