1 /***************************************************************************
2 * Copyright (C) 2005-2018 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"
30 class InternalPeer : public Peer
35 InternalPeer(QObject *parent = nullptr);
36 ~InternalPeer() override;
38 Protocol::Type protocol() const override { return Protocol::InternalProtocol; }
39 QString description() const override;
41 QString address() const override;
42 quint16 port() const override;
44 SignalProxy *signalProxy() const override;
45 void setSignalProxy(SignalProxy *proxy) override;
47 InternalPeer *peer() const;
48 void setPeer(InternalPeer *peer);
50 bool isOpen() const override;
51 bool isSecure() const override;
52 bool isLocal() const override;
54 int lag() const override;
56 void dispatch(const Protocol::SyncMessage &msg) override;
57 void dispatch(const Protocol::RpcCall &msg) override;
58 void dispatch(const Protocol::InitRequest &msg) override;
59 void dispatch(const Protocol::InitData &msg) override;
61 /* These are not needed for InternalPeer */
62 void dispatch(const Protocol::RegisterClient &) override {}
63 void dispatch(const Protocol::ClientDenied &) override {}
64 void dispatch(const Protocol::ClientRegistered &) override {}
65 void dispatch(const Protocol::SetupData &) override {}
66 void dispatch(const Protocol::SetupFailed &) override {}
67 void dispatch(const Protocol::SetupDone &) override {}
68 void dispatch(const Protocol::Login &) override {}
69 void dispatch(const Protocol::LoginFailed &) override {}
70 void dispatch(const Protocol::LoginSuccess &) override {}
71 void dispatch(const Protocol::SessionState &) override {}
74 void close(const QString &reason = QString()) override;
77 void dispatchMessage(const Protocol::SyncMessage &msg);
78 void dispatchMessage(const Protocol::RpcCall &msg);
79 void dispatchMessage(const Protocol::InitRequest &msg);
80 void dispatchMessage(const Protocol::InitData &msg);
83 void peerDisconnected();
85 void handleMessage(const Protocol::SyncMessage &msg);
86 void handleMessage(const Protocol::RpcCall &msg);
87 void handleMessage(const Protocol::InitRequest &msg);
88 void handleMessage(const Protocol::InitData &msg);
92 void handle(const T &msg);
95 SignalProxy *_proxy{nullptr};
99 Q_DECLARE_METATYPE(QPointer<InternalPeer>)