diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-06-08 19:05:04 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-06-08 19:05:04 +0900 |
commit | 4b1b308f28bdaef598a5dfc249d7af6a0346b367 (patch) | |
tree | 7684ff7c6c616fc7b1d1c156e15e3e9a2577597c /lib | |
parent | c5ebff775e71b5d32a3b2af8f666e3f13f8970c2 (diff) | |
download | libquotient-4b1b308f28bdaef598a5dfc249d7af6a0346b367.tar.gz libquotient-4b1b308f28bdaef598a5dfc249d7af6a0346b367.zip |
SyncJob: Support receiving to_device and presence events
Diffstat (limited to 'lib')
-rw-r--r-- | lib/jobs/syncjob.cpp | 13 | ||||
-rw-r--r-- | lib/jobs/syncjob.h | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/jobs/syncjob.cpp b/lib/jobs/syncjob.cpp index a739ea0d..a366cece 100644 --- a/lib/jobs/syncjob.cpp +++ b/lib/jobs/syncjob.cpp @@ -54,11 +54,21 @@ SyncDataList&& SyncData::takeRoomData() return std::move(roomData); } +Events&& SyncData::takePresenceData() +{ + return std::move(presenceData); +} + Events&& SyncData::takeAccountData() { return std::move(accountData); } +Events&&SyncData::takeToDeviceEvents() +{ + return std::move(toDeviceEvents); +} + template <typename EventsArrayT, typename StrT> inline EventsArrayT load(const QJsonObject& batches, StrT keyName) { @@ -76,8 +86,9 @@ BaseJob::Status SyncData::parseJson(const QJsonDocument &data) auto json = data.object(); nextBatch_ = json.value("next_batch").toString(); - // TODO: presence + presenceData = load<Events>(json, "presence"); accountData = load<Events>(json, "account_data"); + toDeviceEvents = load<Events>(json, "to_device"); QJsonObject rooms = json.value("rooms").toObject(); JoinStates::Int ii = 1; // ii is used to make a JoinState value diff --git a/lib/jobs/syncjob.h b/lib/jobs/syncjob.h index b12f9fff..ca30848e 100644 --- a/lib/jobs/syncjob.h +++ b/lib/jobs/syncjob.h @@ -56,13 +56,17 @@ namespace QMatrixClient { public: BaseJob::Status parseJson(const QJsonDocument &data); + Events&& takePresenceData(); Events&& takeAccountData(); + Events&& takeToDeviceEvents(); SyncDataList&& takeRoomData(); QString nextBatch() const; private: QString nextBatch_; + Events presenceData; Events accountData; + Events toDeviceEvents; SyncDataList roomData; }; |