diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-25 15:09:17 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-26 09:06:34 +0900 |
commit | a2f991555bec7b317606093e95ec2b5684b0005a (patch) | |
tree | a655b1183336f3f0e2345b27b1fa9cda74d54ab5 /jobs/syncjob.cpp | |
parent | e77a53946805649be99f8c0f6ee9c00702348132 (diff) | |
download | libquotient-a2f991555bec7b317606093e95ec2b5684b0005a.tar.gz libquotient-a2f991555bec7b317606093e95ec2b5684b0005a.zip |
SyncJob: parse events from global account data too
Closes #123 (room account data were parsed even before). No specific event classes for account data yet, though.
Diffstat (limited to 'jobs/syncjob.cpp')
-rw-r--r-- | jobs/syncjob.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp index ce5dd894..7b066f4f 100644 --- a/jobs/syncjob.cpp +++ b/jobs/syncjob.cpp @@ -54,6 +54,11 @@ SyncDataList&& SyncData::takeRoomData() return std::move(roomData); } +SyncBatch<Event>&& SyncData::takeAccountData() +{ + return std::move(accountData); +} + BaseJob::Status SyncJob::parseJson(const QJsonDocument& data) { return d.parseJson(data); @@ -63,12 +68,12 @@ BaseJob::Status SyncData::parseJson(const QJsonDocument &data) { QElapsedTimer et; et.start(); - QJsonObject json = data.object(); + auto json { data.object() }; nextBatch_ = json.value("next_batch").toString(); // TODO: presence - // TODO: account_data - QJsonObject rooms = json.value("rooms").toObject(); + accountData.fromJson(json); + QJsonObject rooms = json.value("rooms").toObject(); for (size_t i = 0; i < JoinStateStrings.size(); ++i) { const auto rs = rooms.value(JoinStateStrings[i]).toObject(); |