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 ***************************************************************************/
26 #include <QVariantList>
39 /*** Handshake, handled by AuthHandler ***/
42 struct HandshakeMessage {
43 inline Handler handler() const { return AuthHandler; }
47 struct RegisterClient : public HandshakeMessage
49 inline RegisterClient(const QString &clientVersion, bool sslSupported = false)
50 : clientVersion(clientVersion)
51 , sslSupported(sslSupported) {}
53 QString clientVersion;
55 // this is only used by the LegacyProtocol in compat mode
60 struct ClientDenied : public HandshakeMessage
62 inline ClientDenied(const QString &errorString)
63 : errorString(errorString) {}
69 struct ClientRegistered : public HandshakeMessage
71 inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, bool sslSupported, const QDateTime &coreStartTime)
72 : coreFeatures(coreFeatures)
73 , coreConfigured(coreConfigured)
74 , backendInfo(backendInfo)
75 , sslSupported(sslSupported)
76 , coreStartTime(coreStartTime)
81 QVariantList backendInfo; // TODO: abstract this better
83 // this is only used by the LegacyProtocol in compat mode
85 QDateTime coreStartTime;
89 struct SetupData : public HandshakeMessage
91 inline SetupData(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData)
92 : adminUser(adminUser), adminPassword(adminPassword), backend(backend), setupData(setupData) {}
95 QString adminPassword;
97 QVariantMap setupData;
101 struct SetupFailed : public HandshakeMessage
103 inline SetupFailed(const QString &errorString)
104 : errorString(errorString) {}
110 struct SetupDone : public HandshakeMessage
112 inline SetupDone() {}
116 struct Login : public HandshakeMessage
118 inline Login(const QString &user, const QString &password)
119 : user(user), password(password) {}
126 struct LoginFailed : public HandshakeMessage
128 inline LoginFailed(const QString &errorString)
129 : errorString(errorString) {}
135 struct LoginSuccess : public HandshakeMessage
137 inline LoginSuccess() {}
141 // TODO: more generic format
142 struct SessionState : public HandshakeMessage
144 inline SessionState() {} // needed for QMetaType (for the mono client)
145 inline SessionState(const QVariantList &identities, const QVariantList &bufferInfos, const QVariantList &networkIds)
146 : identities(identities), bufferInfos(bufferInfos), networkIds(networkIds) {}
148 QVariantList identities;
149 QVariantList bufferInfos;
150 QVariantList networkIds;
153 /*** handled by SignalProxy ***/
155 struct SignalProxyMessage
157 inline Handler handler() const { return SignalProxy; }
161 struct SyncMessage : public SignalProxyMessage
163 inline SyncMessage(const QByteArray &className, const QString &objectName, const QByteArray &slotName, const QVariantList ¶ms)
164 : className(className), objectName(objectName), slotName(slotName), params(params) {}
166 QByteArray className;
173 struct RpcCall : public SignalProxyMessage
175 inline RpcCall(const QByteArray &slotName, const QVariantList ¶ms)
176 : slotName(slotName), params(params) {}
183 struct InitRequest : public SignalProxyMessage
185 inline InitRequest(const QByteArray &className, const QString &objectName)
186 : className(className), objectName(objectName) {}
188 QByteArray className;
193 struct InitData : public SignalProxyMessage
195 inline InitData(const QByteArray &className, const QString &objectName, const QVariantMap &initData)
196 : className(className), objectName(objectName), initData(initData) {}
198 QByteArray className;
200 QVariantMap initData;
204 /*** handled by RemoteConnection ***/
208 inline HeartBeat(const QDateTime ×tamp) : timestamp(timestamp) {}
214 struct HeartBeatReply
216 inline HeartBeatReply(const QDateTime ×tamp) : timestamp(timestamp) {}