X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fprotocol.h;h=2453a52051d45ea6f4ec6d3fbb09a766bb2d9b60;hb=6fd69e84e6c395a108e6b2620c6428907b7d7efd;hp=e626686277245eade9606b7aef6c35ef6845837a;hpb=f353beded3963b67da6ac0878700dee8e61abfc4;p=quassel.git diff --git a/src/common/protocol.h b/src/common/protocol.h index e6266862..2453a520 100644 --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -24,6 +24,8 @@ #include #include +#include "quassel.h" + namespace Protocol { const quint32 magic = 0x42b33f00; @@ -56,18 +58,19 @@ struct HandshakeMessage { struct RegisterClient : public HandshakeMessage { - inline RegisterClient(const QString &clientVersion, const QString &buildDate, bool sslSupported = false, quint32 features = 0) - : clientVersion(clientVersion) - , buildDate(buildDate) - , sslSupported(sslSupported) - , clientFeatures(features) {} + 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; // this is only used by the LegacyProtocol in compat mode bool sslSupported; - quint32 clientFeatures; }; @@ -82,19 +85,19 @@ struct ClientDenied : public HandshakeMessage struct ClientRegistered : public HandshakeMessage { - inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, bool sslSupported, const QVariantList &authenticatorInfo) - : coreFeatures(coreFeatures) - , coreConfigured(coreConfigured) - , backendInfo(backendInfo) - , authenticatorInfo(authenticatorInfo) - , 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; + QVariantList backendInfo; // TODO: abstract this better // The authenticatorInfo should be optional! - QVariantList backendInfo; // TODO: abstract this better QVariantList authenticatorInfo; // this is only used by the LegacyProtocol in compat mode @@ -186,8 +189,9 @@ struct SignalProxyMessage struct SyncMessage : public SignalProxyMessage { - inline SyncMessage(const QByteArray &className, const QString &objectName, const QByteArray &slotName, const QVariantList ¶ms) - : className(className), objectName(objectName), slotName(slotName), params(params) {} + SyncMessage() = default; + SyncMessage(const QByteArray &className, const QString &objectName, const QByteArray &slotName, const QVariantList ¶ms) + : className(className), objectName(objectName), slotName(slotName), params(params) {} QByteArray className; QString objectName; @@ -198,8 +202,9 @@ struct SyncMessage : public SignalProxyMessage struct RpcCall : public SignalProxyMessage { - inline RpcCall(const QByteArray &slotName, const QVariantList ¶ms) - : slotName(slotName), params(params) {} + RpcCall() = default; + RpcCall(const QByteArray &slotName, const QVariantList ¶ms) + : slotName(slotName), params(params) {} QByteArray slotName; QVariantList params; @@ -208,8 +213,9 @@ struct RpcCall : public SignalProxyMessage struct InitRequest : public SignalProxyMessage { - inline InitRequest(const QByteArray &className, const QString &objectName) - : className(className), objectName(objectName) {} + InitRequest() = default; + InitRequest(const QByteArray &className, const QString &objectName) + : className(className), objectName(objectName) {} QByteArray className; QString objectName; @@ -218,8 +224,9 @@ struct InitRequest : public SignalProxyMessage struct InitData : public SignalProxyMessage { - inline InitData(const QByteArray &className, const QString &objectName, const QVariantMap &initData) - : className(className), objectName(objectName), initData(initData) {} + InitData() = default; + InitData(const QByteArray &className, const QString &objectName, const QVariantMap &initData) + : className(className), objectName(objectName), initData(initData) {} QByteArray className; QString objectName; @@ -246,3 +253,9 @@ struct HeartBeatReply }; + +// Required for InternalPeer +Q_DECLARE_METATYPE(Protocol::SyncMessage) +Q_DECLARE_METATYPE(Protocol::RpcCall) +Q_DECLARE_METATYPE(Protocol::InitRequest) +Q_DECLARE_METATYPE(Protocol::InitData)