X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fprotocol.h;h=38e53c6d6a6a6ccc4cd2cfca3cd9e1959642be67;hb=9f91e0dd3c4eb5c2e2dedfc8d36a068d433d51b1;hp=b686a513171e81094dcc5a1e950f42e4b71f9b30;hpb=61aac1868f15babb7086d8bc6bbcff530346f438;p=quassel.git diff --git a/src/common/protocol.h b/src/common/protocol.h index b686a513..38e53c6d 100644 --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -18,13 +18,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef PROTOCOL_H_ -#define PROTOCOL_H_ +#pragma once #include #include #include +#include "quassel.h" + namespace Protocol { const quint32 magic = 0x42b33f00; @@ -42,7 +43,7 @@ enum Feature { }; -enum Handler { +enum class Handler { SignalProxy, AuthHandler }; @@ -51,17 +52,20 @@ enum Handler { /*** Handshake, handled by AuthHandler ***/ struct HandshakeMessage { - inline Handler handler() const { return AuthHandler; } + inline Handler handler() const { return Handler::AuthHandler; } }; struct RegisterClient : public HandshakeMessage { - inline RegisterClient(const QString &clientVersion, const QString &buildDate, bool sslSupported = false) - : clientVersion(clientVersion) - , buildDate(buildDate) - , sslSupported(sslSupported) {} + inline RegisterClient(Quassel::Features clientFeatures, const QString &clientVersion, const QString &buildDate, bool sslSupported = false) + : features(std::move(clientFeatures)) + , clientVersion(clientVersion) + , buildDate(buildDate) + , sslSupported(sslSupported) + {} + Quassel::Features features; QString clientVersion; QString buildDate; @@ -81,21 +85,21 @@ struct ClientDenied : public HandshakeMessage struct ClientRegistered : public HandshakeMessage { - inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, const QVariantList &authBackendInfo, bool sslSupported) - : coreFeatures(coreFeatures) - , coreConfigured(coreConfigured) - , backendInfo(backendInfo) - , authBackendInfo(authBackendInfo) - , sslSupported(sslSupported) + inline ClientRegistered(Quassel::Features coreFeatures, bool coreConfigured, const QVariantList &backendInfo, const QVariantList &authenticatorInfo, bool sslSupported) + : features(std::move(coreFeatures)) + , coreConfigured(coreConfigured) + , backendInfo(backendInfo) + , authenticatorInfo(authenticatorInfo) + , sslSupported(sslSupported) {} - quint32 coreFeatures; + Quassel::Features features; bool coreConfigured; - - // The authBackendInfo should be optional! QVariantList backendInfo; // TODO: abstract this better - QVariantList authBackendInfo; - + + // The authenticatorInfo should be optional! + QVariantList authenticatorInfo; + // this is only used by the LegacyProtocol in compat mode bool sslSupported; }; @@ -103,15 +107,23 @@ struct ClientRegistered : public HandshakeMessage struct SetupData : public HandshakeMessage { - inline SetupData(const QString &adminUser, const QString &adminPassword, const QString &backend, const QString &authenticator, const QVariantMap &setupData, const QVariantMap &authSetupData) - : adminUser(adminUser), adminPassword(adminPassword), backend(backend), authenticator(authenticator), setupData(setupData), authSetupData(authSetupData) {} + inline SetupData(const QString &adminUser, const QString &adminPassword, const QString &backend, + const QVariantMap &setupData, const QString &authenticator = QString(), + const QVariantMap &authSetupData = QVariantMap()) + : adminUser(adminUser) + , adminPassword(adminPassword) + , backend(backend) + , setupData(setupData) + , authenticator(authenticator) + , authSetupData(authSetupData) + {} QString adminUser; QString adminPassword; QString backend; - QString authenticator; QVariantMap setupData; - QVariantMap authSetupData; + QString authenticator; + QVariantMap authSetupData; }; @@ -171,7 +183,7 @@ struct SessionState : public HandshakeMessage struct SignalProxyMessage { - inline Handler handler() const { return SignalProxy; } + inline Handler handler() const { return Handler::SignalProxy; } }; @@ -237,5 +249,3 @@ struct HeartBeatReply }; - -#endif