diff options
Diffstat (limited to 'lib/application-service/definitions/user.h')
-rw-r--r-- | lib/application-service/definitions/user.h | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/lib/application-service/definitions/user.h b/lib/application-service/definitions/user.h index 062d2cac..3342ef80 100644 --- a/lib/application-service/definitions/user.h +++ b/lib/application-service/definitions/user.h @@ -6,25 +6,33 @@ #include "converters.h" -#include <QtCore/QJsonObject> +namespace Quotient { -namespace QMatrixClient -{ - // Data structures +struct ThirdPartyUser { + /// A Matrix User ID represting a third party user. + QString userid; - struct ThirdPartyUser + /// The protocol ID that the third party location is a part of. + QString protocol; + + /// Information used to identify this third party location. + QJsonObject fields; +}; + +template <> +struct JsonObjectConverter<ThirdPartyUser> { + static void dumpTo(QJsonObject& jo, const ThirdPartyUser& pod) { - /// A Matrix User ID represting a third party user. - QString userid; - /// The protocol ID that the third party location is a part of. - QString protocol; - /// Information used to identify this third party location. - QJsonObject fields; - }; - template <> struct JsonObjectConverter<ThirdPartyUser> + addParam<>(jo, QStringLiteral("userid"), pod.userid); + addParam<>(jo, QStringLiteral("protocol"), pod.protocol); + addParam<>(jo, QStringLiteral("fields"), pod.fields); + } + static void fillFrom(const QJsonObject& jo, ThirdPartyUser& pod) { - static void dumpTo(QJsonObject& jo, const ThirdPartyUser& pod); - static void fillFrom(const QJsonObject& jo, ThirdPartyUser& pod); - }; + fromJson(jo.value("userid"_ls), pod.userid); + fromJson(jo.value("protocol"_ls), pod.protocol); + fromJson(jo.value("fields"_ls), pod.fields); + } +}; -} // namespace QMatrixClient +} // namespace Quotient |