diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-09-03 22:32:33 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-09-04 22:45:53 +0200 |
commit | 65c60c786dd18553a804e01ac60e5a167cb0a400 (patch) | |
tree | d8d4e0a54310836fc5a63aed44f2b3ff33146527 /lib/syncdata.cpp | |
parent | c641e3f070d6687e10a2cdb9fe3e4f7d12c5704f (diff) | |
download | libquotient-65c60c786dd18553a804e01ac60e5a167cb0a400.tar.gz libquotient-65c60c786dd18553a804e01ac60e5a167cb0a400.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.cpp | 8 |
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 |