diff options
author | Tobias Fella <9750016+TobiasFella@users.noreply.github.com> | 2021-12-25 21:51:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-25 21:51:17 +0100 |
commit | ff415143b0d953f04a207125e265111b925ce763 (patch) | |
tree | 5f3a457afd69e00d37e2928bda65257bc8d20f86 | |
parent | 3164daa6d6cbfb75a1528b2671f5c78422a5539e (diff) | |
download | libquotient-ff415143b0d953f04a207125e265111b925ce763.tar.gz libquotient-ff415143b0d953f04a207125e265111b925ce763.zip |
Apply suggestions from code review
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
-rw-r--r-- | lib/connection.cpp | 6 | ||||
-rw-r--r-- | 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<QString> trackedUsers; QSet<QString> outdatedUsers; - QHash<QString, QHash<QString, QueryKeysJob::DeviceInformation>> deviceKeys; + QHash<QString, QHash<QString, DeviceKeys>> 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<QHash<QString, QHash<QString, QueryKeysJob::DeviceInformation>>>(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<QHash<QString, QHash<QString, QueryKeysJob::DeviceInformation>>>(json["devices_list"].toObject()); + fromJson(json["devices_list"], deviceKeys); auto oldToken = json["sync_token"].toString(); auto changesJob = q->callApi<GetKeysChangesJob>(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<QueryKeysJob::DeviceInformation> { fillFromJson<DeviceKeys>(jo, result); fromJson(jo.value("unsigned"_ls), result.unsignedData); } - static void dumpTo(QJsonObject& jo, const QueryKeysJob::DeviceInformation& deviceInformation) - { - jo = toJson<DeviceKeys>(deviceInformation); - //addParam<>(jo, "unsigned"_ls, deviceInformation.unsignedData); - } }; /*! \brief Claim one-time encryption keys. |