aboutsummaryrefslogtreecommitdiff
path: root/lib/syncdata.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-09-03 22:32:33 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-09-03 22:32:33 +0200
commit813c8e3fe0da9ee3b46fff1618d3e4ed05f2c429 (patch)
tree17611f3c85bf28471c1eceb651193dec9bcd26e8 /lib/syncdata.cpp
parentb0f6671d212b8c8d0c9e310cf72f45445c261bf6 (diff)
downloadlibquotient-813c8e3fe0da9ee3b46fff1618d3e4ed05f2c429.tar.gz
libquotient-813c8e3fe0da9ee3b46fff1618d3e4ed05f2c429.zip
SyndData::parseJson: use fromJson()
...instead of a complicated explicit code converting from JSON to varianthash to hash.
Diffstat (limited to 'lib/syncdata.cpp')
-rw-r--r--lib/syncdata.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp
index a9ec5ee7..e6472e18 100644
--- a/lib/syncdata.cpp
+++ b/lib/syncdata.cpp
@@ -182,12 +182,8 @@ void SyncData::parseJson(const QJsonObject& json, const QString& baseDir)
accountData = load<Events>(json, "account_data"_ls);
toDeviceEvents = load<Events>(json, "to_device"_ls);
- auto deviceOneTimeKeysCountVariantHash =
- json.value("device_one_time_keys_count"_ls).toObject().toVariantHash();
- for (auto key : deviceOneTimeKeysCountVariantHash.keys()) {
- deviceOneTimeKeysCount_.insert(
- key, deviceOneTimeKeysCountVariantHash.value(key).toInt());
- }
+ fromJson(json.value("device_one_time_keys_count"_ls),
+ deviceOneTimeKeysCount_);
auto rooms = json.value("rooms"_ls).toObject();
JoinStates::Int ii = 1; // ii is used to make a JoinState value