X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fpeer.h;h=64a333ce671852d9e6d91c7b2c3c713da0096e94;hp=2bdcc563b7603ca0d278af1c6a70fbc347e30944;hb=323034d98bb5e2cee84234e3095435825d2bd1ad;hpb=ea6cba5aeeb026b41d85f45a3f4707cf52f7740b diff --git a/src/common/peer.h b/src/common/peer.h index 2bdcc563..64a333ce 100644 --- a/src/common/peer.h +++ b/src/common/peer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 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,13 +34,26 @@ 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; 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; @@ -48,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; @@ -80,12 +97,22 @@ 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 typedef Peer * PeerPtr; Q_DECLARE_METATYPE(PeerPtr) +QDataStream &operator<<(QDataStream &out, PeerPtr ptr); +QDataStream &operator>>(QDataStream &in, PeerPtr &ptr); + // Template method needed in the header template inline