aboutsummaryrefslogtreecommitdiff
path: root/lib/application-service/definitions/user.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-29 22:22:49 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-29 22:22:49 +0900
commitb55334ac0fe89f780776bc4eab90ffe1ca3c57bb (patch)
tree1a45c0ccfec8f5f7ba37eb4385cdc7f61afa0c97 /lib/application-service/definitions/user.cpp
parentf5c2e47fa1ab84fdaffe03c30ba973d7dea5ac05 (diff)
parent1e6510790dab6b9141ae52993987b406399668cd (diff)
downloadlibquotient-b55334ac0fe89f780776bc4eab90ffe1ca3c57bb.tar.gz
libquotient-b55334ac0fe89f780776bc4eab90ffe1ca3c57bb.zip
Merge branch 'cs-api-0.4.0'
Diffstat (limited to 'lib/application-service/definitions/user.cpp')
-rw-r--r--lib/application-service/definitions/user.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/application-service/definitions/user.cpp b/lib/application-service/definitions/user.cpp
index 17687cfd..ca334236 100644
--- a/lib/application-service/definitions/user.cpp
+++ b/lib/application-service/definitions/user.cpp
@@ -8,24 +8,23 @@ using namespace QMatrixClient;
QJsonObject QMatrixClient::toJson(const ThirdPartyUser& pod)
{
- QJsonObject _json;
- addParam<IfNotEmpty>(_json, QStringLiteral("userid"), pod.userid);
- addParam<IfNotEmpty>(_json, QStringLiteral("protocol"), pod.protocol);
- addParam<IfNotEmpty>(_json, QStringLiteral("fields"), pod.fields);
- return _json;
+ QJsonObject jo;
+ addParam<>(jo, QStringLiteral("userid"), pod.userid);
+ addParam<>(jo, QStringLiteral("protocol"), pod.protocol);
+ addParam<>(jo, QStringLiteral("fields"), pod.fields);
+ return jo;
}
-ThirdPartyUser FromJson<ThirdPartyUser>::operator()(const QJsonValue& jv)
+ThirdPartyUser FromJsonObject<ThirdPartyUser>::operator()(const QJsonObject& jo) const
{
- const auto& _json = jv.toObject();
ThirdPartyUser result;
result.userid =
- fromJson<QString>(_json.value("userid"_ls));
+ fromJson<QString>(jo.value("userid"_ls));
result.protocol =
- fromJson<QString>(_json.value("protocol"_ls));
+ fromJson<QString>(jo.value("protocol"_ls));
result.fields =
- fromJson<QJsonObject>(_json.value("fields"_ls));
-
+ fromJson<QJsonObject>(jo.value("fields"_ls));
+
return result;
}