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 ***************************************************************************/
27 #include "signalproxy.h"
29 class InternalPeer : public Peer
34 InternalPeer(QObject *parent = nullptr);
35 ~InternalPeer() override;
37 Protocol::Type protocol() const override { return Protocol::InternalProtocol; }
38 QString description() const override;
40 QString address() const override;
41 quint16 port() const override;
43 SignalProxy *signalProxy() const override;
44 void setSignalProxy(SignalProxy *proxy) override;
46 InternalPeer *peer() const;
47 void setPeer(InternalPeer *peer);
49 bool isOpen() const override;
50 bool isSecure() const override;
51 bool isLocal() const override;
53 int lag() const override;
55 void dispatch(const Protocol::SyncMessage &msg) override;
56 void dispatch(const Protocol::RpcCall &msg) override;
57 void dispatch(const Protocol::InitRequest &msg) override;
58 void dispatch(const Protocol::InitData &msg) override;
60 /* These are not needed for InternalPeer */
61 void dispatch(const Protocol::RegisterClient &) override {}
62 void dispatch(const Protocol::ClientDenied &) override {}
63 void dispatch(const Protocol::ClientRegistered &) override {}
64 void dispatch(const Protocol::SetupData &) override {}
65 void dispatch(const Protocol::SetupFailed &) override {}
66 void dispatch(const Protocol::SetupDone &) override {}
67 void dispatch(const Protocol::Login &) override {}
68 void dispatch(const Protocol::LoginFailed &) override {}
69 void dispatch(const Protocol::LoginSuccess &) override {}
70 void dispatch(const Protocol::SessionState &) override {}
73 void close(const QString &reason = QString()) override;
76 void dispatchMessage(const Protocol::SyncMessage &msg);
77 void dispatchMessage(const Protocol::RpcCall &msg);
78 void dispatchMessage(const Protocol::InitRequest &msg);
79 void dispatchMessage(const Protocol::InitData &msg);
82 void peerDisconnected();
84 void handleMessage(const Protocol::SyncMessage &msg);
85 void handleMessage(const Protocol::RpcCall &msg);
86 void handleMessage(const Protocol::InitRequest &msg);
87 void handleMessage(const Protocol::InitData &msg);
91 void handle(const T &msg);
94 SignalProxy *_proxy{nullptr};