From be838b2f4f294a7e1b3f8a771f91d9d1eac14431 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 22 May 2017 10:22:28 +0900 Subject: Refactored Events The biggest change is we have no pimpls in Event objects anymore - because it's two new's instead of one per Event, and we have thousands and even more of Events created during initial sync. The other big change is introduction of RoomEvent, so that now the structure of events almost precisely reflects the CS API spec. The refactoring made UnknownEvent unnecessary as a separate class; a respective base class (either RoomEvent or Event) is used for this purpose now. All the other changes are consequences of these (mostly of RoomEvent introduction). --- jobs/roommessagesjob.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'jobs/roommessagesjob.cpp') diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp index a48403c8..3e603a50 100644 --- a/jobs/roommessagesjob.cpp +++ b/jobs/roommessagesjob.cpp @@ -17,16 +17,15 @@ */ #include "roommessagesjob.h" -#include "../util.h" -#include +#include "util.h" using namespace QMatrixClient; class RoomMessagesJob::Private { public: - Owning events; + Owning events; QString end; }; @@ -49,7 +48,7 @@ RoomMessagesJob::~RoomMessagesJob() delete d; } -Events RoomMessagesJob::releaseEvents() +RoomEvents RoomMessagesJob::releaseEvents() { return d->events.release(); } @@ -62,7 +61,7 @@ QString RoomMessagesJob::end() BaseJob::Status RoomMessagesJob::parseJson(const QJsonDocument& data) { QJsonObject obj = data.object(); - d->events.assign(eventsFromJson(obj.value("chunk").toArray())); + d->events.assign(makeEvents(obj.value("chunk").toArray())); d->end = obj.value("end").toString(); return Success; } -- cgit v1.2.3