From ff415143b0d953f04a207125e265111b925ce763 Mon Sep 17 00:00:00 2001 From: Tobias Fella <9750016+TobiasFella@users.noreply.github.com> Date: Sat, 25 Dec 2021 21:51:17 +0100 Subject: Apply suggestions from code review Co-authored-by: Alexey Rusakov --- lib/connection.cpp | 6 +++--- lib/csapi/keys.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/connection.cpp b/lib/connection.cpp index 138f968f..89b80909 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -112,7 +112,7 @@ public: #ifdef Quotient_E2EE_ENABLED QSet trackedUsers; QSet outdatedUsers; - QHash> deviceKeys; + QHash> deviceKeys; QueryKeysJob *currentQueryKeysJob = nullptr; bool encryptionUpdateRequired = false; PicklingMode picklingMode = Unencrypted {}; @@ -1975,7 +1975,7 @@ void Connection::Private::saveDevicesList() } rootObj.insert(QStringLiteral("tracked_users"), trackedUsersJson); rootObj.insert(QStringLiteral("outdated_users"), outdatedUsersJson); - QJsonObject devicesList = toJson>>(deviceKeys); + const auto devicesList = toJson(deviceKeys); rootObj.insert(QStringLiteral("devices_list"), devicesList); rootObj.insert(QStringLiteral("sync_token"), q->nextBatchToken()); } @@ -2023,7 +2023,7 @@ void Connection::Private::loadDevicesList() outdatedUsers += user.toString(); } - deviceKeys = fromJson>>(json["devices_list"].toObject()); + fromJson(json["devices_list"], deviceKeys); auto oldToken = json["sync_token"].toString(); auto changesJob = q->callApi(oldToken, q->nextBatchToken()); connect(changesJob, &BaseJob::success, q, [this, changesJob](){ diff --git a/lib/csapi/keys.h b/lib/csapi/keys.h index b1cc640c..7db09e8d 100644 --- a/lib/csapi/keys.h +++ b/lib/csapi/keys.h @@ -166,11 +166,6 @@ struct JsonObjectConverter { fillFromJson(jo, result); fromJson(jo.value("unsigned"_ls), result.unsignedData); } - static void dumpTo(QJsonObject& jo, const QueryKeysJob::DeviceInformation& deviceInformation) - { - jo = toJson(deviceInformation); - //addParam<>(jo, "unsigned"_ls, deviceInformation.unsignedData); - } }; /*! \brief Claim one-time encryption keys. -- cgit v1.2.3