1 /***************************************************************************
2 * Copyright (C) 2005-2014 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
28 #include "signalproxy.h"
35 class RemotePeer : public Peer
40 // import the virtuals from the baseclass
44 RemotePeer(AuthHandler *authHandler, QTcpSocket *socket, QObject *parent = 0);
46 void setSignalProxy(SignalProxy *proxy);
48 virtual Protocol::Type protocol() const = 0;
49 virtual QString description() const;
50 virtual quint16 enabledFeatures() const { return 0; }
53 bool isSecure() const;
58 bool compressionEnabled() const;
59 void setCompressionEnabled(bool enabled);
61 QTcpSocket *socket() const;
64 void close(const QString &reason = QString());
67 void transferProgress(int current, int max);
68 void socketError(QAbstractSocket::SocketError error, const QString &errorString);
69 void statusMessage(const QString &msg);
72 SignalProxy *signalProxy() const;
74 // These protocol messages get handled internally and won't reach SignalProxy
75 void handle(const Protocol::HeartBeat &heartBeat);
76 void handle(const Protocol::HeartBeatReply &heartBeatReply);
77 virtual void dispatch(const Protocol::HeartBeat &msg) = 0;
78 virtual void dispatch(const Protocol::HeartBeatReply &msg) = 0;
81 virtual void onSocketDataAvailable() = 0;
82 virtual void onSocketStateChanged(QAbstractSocket::SocketState state);
83 virtual void onSocketError(QAbstractSocket::SocketError error);
87 void changeHeartBeatInterval(int secs);
91 SignalProxy *_signalProxy;
92 QTimer *_heartBeatTimer;