aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/jobs/syncjob.cpp13
-rw-r--r--lib/jobs/syncjob.h4
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;
};