aboutsummaryrefslogtreecommitdiff
path: root/jobs/syncjob.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-26 09:07:16 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-26 09:07:16 +0900
commit91cc0e8db0006beeb91b9e007cd21343984dfb6a (patch)
tree7a79286d7c6e5a99644c3f7141e1cdc8e2459416 /jobs/syncjob.h
parente77a53946805649be99f8c0f6ee9c00702348132 (diff)
parentec412621d71b1a7758b15d2b3c5cd5e7b2081ab1 (diff)
downloadlibquotient-91cc0e8db0006beeb91b9e007cd21343984dfb6a.tar.gz
libquotient-91cc0e8db0006beeb91b9e007cd21343984dfb6a.zip
Merge branch 'kitsune-account-data'
Diffstat (limited to 'jobs/syncjob.h')
-rw-r--r--jobs/syncjob.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/jobs/syncjob.h b/jobs/syncjob.h
index aed36e0b..5956e73b 100644
--- a/jobs/syncjob.h
+++ b/jobs/syncjob.h
@@ -26,30 +26,30 @@
namespace QMatrixClient
{
- class SyncRoomData
+ template <typename EventT>
+ class SyncBatch : public EventsBatch<EventT>
{
public:
- template <typename EventT>
- class Batch : public EventsBatch<EventT>
+ explicit SyncBatch(QString k) : jsonKey(std::move(k)) { }
+ void fromJson(const QJsonObject& roomContents)
{
- public:
- explicit Batch(QString k) : jsonKey(std::move(k)) { }
- void fromJson(const QJsonObject& roomContents)
- {
- EventsBatch<EventT>::fromJson(
- roomContents[jsonKey].toObject(), "events");
- }
+ EventsBatch<EventT>::fromJson(
+ roomContents[jsonKey].toObject(), "events");
+ }
- private:
- QString jsonKey;
- };
+ private:
+ QString jsonKey;
+ };
+ class SyncRoomData
+ {
+ public:
QString roomId;
JoinState joinState;
- Batch<RoomEvent> state;
- Batch<RoomEvent> timeline;
- Batch<Event> ephemeral;
- Batch<Event> accountData;
+ SyncBatch<RoomEvent> state;
+ SyncBatch<RoomEvent> timeline;
+ SyncBatch<Event> ephemeral;
+ SyncBatch<Event> accountData;
bool timelineLimited;
QString timelinePrevBatch;
@@ -68,11 +68,13 @@ namespace QMatrixClient
{
public:
BaseJob::Status parseJson(const QJsonDocument &data);
+ SyncBatch<Event>&& takeAccountData();
SyncDataList&& takeRoomData();
QString nextBatch() const;
private:
QString nextBatch_;
+ SyncBatch<Event> accountData { "account_data" };
SyncDataList roomData;
};