diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-02 17:58:34 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-07-04 20:13:43 +0900 |
commit | 3dd6b5e6cc50aafce74b21b5a0bf4b26a9fcf6ee (patch) | |
tree | a647fa5328e04b20a84e46d29d420555d9c56cde /lib/csapi/admin.cpp | |
parent | ed467d27b07781fdd2f7ddef043568954ce50b69 (diff) | |
download | libquotient-3dd6b5e6cc50aafce74b21b5a0bf4b26a9fcf6ee.tar.gz libquotient-3dd6b5e6cc50aafce74b21b5a0bf4b26a9fcf6ee.zip |
Use QStringLiteral() and operator"" _ls() in network jobs
Diffstat (limited to 'lib/csapi/admin.cpp')
-rw-r--r-- | lib/csapi/admin.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/csapi/admin.cpp b/lib/csapi/admin.cpp index a0f7f67f..3effbbc3 100644 --- a/lib/csapi/admin.cpp +++ b/lib/csapi/admin.cpp @@ -23,11 +23,11 @@ namespace QMatrixClient const auto& _json = jv.toObject(); GetWhoIsJob::ConnectionInfo result; result.ip = - fromJson<QString>(_json.value("ip")); + fromJson<QString>(_json.value("ip"_ls)); result.lastSeen = - fromJson<qint64>(_json.value("last_seen")); + fromJson<qint64>(_json.value("last_seen"_ls)); result.userAgent = - fromJson<QString>(_json.value("user_agent")); + fromJson<QString>(_json.value("user_agent"_ls)); return result; } @@ -40,7 +40,7 @@ namespace QMatrixClient const auto& _json = jv.toObject(); GetWhoIsJob::SessionInfo result; result.connections = - fromJson<QVector<GetWhoIsJob::ConnectionInfo>>(_json.value("connections")); + fromJson<QVector<GetWhoIsJob::ConnectionInfo>>(_json.value("connections"_ls)); return result; } @@ -53,7 +53,7 @@ namespace QMatrixClient const auto& _json = jv.toObject(); GetWhoIsJob::DeviceInfo result; result.sessions = - fromJson<QVector<GetWhoIsJob::SessionInfo>>(_json.value("sessions")); + fromJson<QVector<GetWhoIsJob::SessionInfo>>(_json.value("sessions"_ls)); return result; } @@ -73,8 +73,10 @@ QUrl GetWhoIsJob::makeRequestUrl(QUrl baseUrl, const QString& userId) basePath % "/admin/whois/" % userId); } +static const auto GetWhoIsJobName = QStringLiteral("GetWhoIsJob"); + GetWhoIsJob::GetWhoIsJob(const QString& userId) - : BaseJob(HttpVerb::Get, "GetWhoIsJob", + : BaseJob(HttpVerb::Get, GetWhoIsJobName, basePath % "/admin/whois/" % userId) , d(new Private) { @@ -95,8 +97,8 @@ const QHash<QString, GetWhoIsJob::DeviceInfo>& GetWhoIsJob::devices() const BaseJob::Status GetWhoIsJob::parseJson(const QJsonDocument& data) { auto json = data.object(); - d->userId = fromJson<QString>(json.value("user_id")); - d->devices = fromJson<QHash<QString, DeviceInfo>>(json.value("devices")); + d->userId = fromJson<QString>(json.value("user_id"_ls)); + d->devices = fromJson<QHash<QString, DeviceInfo>>(json.value("devices"_ls)); return Success; } |