diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-29 22:22:49 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-29 22:22:49 +0900 |
commit | b55334ac0fe89f780776bc4eab90ffe1ca3c57bb (patch) | |
tree | 1a45c0ccfec8f5f7ba37eb4385cdc7f61afa0c97 /lib/csapi/admin.cpp | |
parent | f5c2e47fa1ab84fdaffe03c30ba973d7dea5ac05 (diff) | |
parent | 1e6510790dab6b9141ae52993987b406399668cd (diff) | |
download | libquotient-b55334ac0fe89f780776bc4eab90ffe1ca3c57bb.tar.gz libquotient-b55334ac0fe89f780776bc4eab90ffe1ca3c57bb.zip |
Merge branch 'cs-api-0.4.0'
Diffstat (limited to 'lib/csapi/admin.cpp')
-rw-r--r-- | lib/csapi/admin.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/csapi/admin.cpp b/lib/csapi/admin.cpp index 3effbbc3..6066d4d9 100644 --- a/lib/csapi/admin.cpp +++ b/lib/csapi/admin.cpp @@ -16,44 +16,41 @@ namespace QMatrixClient { // Converters - template <> struct FromJson<GetWhoIsJob::ConnectionInfo> + template <> struct FromJsonObject<GetWhoIsJob::ConnectionInfo> { - GetWhoIsJob::ConnectionInfo operator()(const QJsonValue& jv) + GetWhoIsJob::ConnectionInfo operator()(const QJsonObject& jo) const { - const auto& _json = jv.toObject(); GetWhoIsJob::ConnectionInfo result; result.ip = - fromJson<QString>(_json.value("ip"_ls)); + fromJson<QString>(jo.value("ip"_ls)); result.lastSeen = - fromJson<qint64>(_json.value("last_seen"_ls)); + fromJson<qint64>(jo.value("last_seen"_ls)); result.userAgent = - fromJson<QString>(_json.value("user_agent"_ls)); + fromJson<QString>(jo.value("user_agent"_ls)); return result; } }; - template <> struct FromJson<GetWhoIsJob::SessionInfo> + template <> struct FromJsonObject<GetWhoIsJob::SessionInfo> { - GetWhoIsJob::SessionInfo operator()(const QJsonValue& jv) + GetWhoIsJob::SessionInfo operator()(const QJsonObject& jo) const { - const auto& _json = jv.toObject(); GetWhoIsJob::SessionInfo result; result.connections = - fromJson<QVector<GetWhoIsJob::ConnectionInfo>>(_json.value("connections"_ls)); + fromJson<QVector<GetWhoIsJob::ConnectionInfo>>(jo.value("connections"_ls)); return result; } }; - template <> struct FromJson<GetWhoIsJob::DeviceInfo> + template <> struct FromJsonObject<GetWhoIsJob::DeviceInfo> { - GetWhoIsJob::DeviceInfo operator()(const QJsonValue& jv) + GetWhoIsJob::DeviceInfo operator()(const QJsonObject& jo) const { - const auto& _json = jv.toObject(); GetWhoIsJob::DeviceInfo result; result.sessions = - fromJson<QVector<GetWhoIsJob::SessionInfo>>(_json.value("sessions"_ls)); + fromJson<QVector<GetWhoIsJob::SessionInfo>>(jo.value("sessions"_ls)); return result; } |