aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'jobs')
-rw-r--r--jobs/roommessagesjob.cpp4
-rw-r--r--jobs/syncjob.h5
2 files changed, 4 insertions, 5 deletions
diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp
index 078c692a..c527cc71 100644
--- a/jobs/roommessagesjob.cpp
+++ b/jobs/roommessagesjob.cpp
@@ -58,8 +58,8 @@ QString RoomMessagesJob::end() const
BaseJob::Status RoomMessagesJob::parseJson(const QJsonDocument& data)
{
- QJsonObject obj = data.object();
- d->events.assign(makeEvents<RoomEvent>(obj.value("chunk").toArray()));
+ const auto obj = data.object();
+ d->events.fromJson(obj, "chunk");
d->end = obj.value("end").toString();
return Success;
}
diff --git a/jobs/syncjob.h b/jobs/syncjob.h
index b1db914d..08bd773e 100644
--- a/jobs/syncjob.h
+++ b/jobs/syncjob.h
@@ -36,11 +36,10 @@ namespace QMatrixClient
explicit Batch(QString k) : jsonKey(std::move(k)) { }
void fromJson(const QJsonObject& roomContents)
{
- this->assign(makeEvents<EventT>(
- roomContents[jsonKey].toObject()["events"].toArray()));
+ EventsBatch<EventT>::fromJson(
+ roomContents[jsonKey].toObject(), "events");
}
-
private:
QString jsonKey;
};