diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-02-26 19:35:09 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-02-28 12:31:39 +0900 |
commit | 81b6d940218a212a37e3c600c66fbe9a7476f433 (patch) | |
tree | 5f13ad36a17ae21be647c8062528bbae0ed67a72 /jobs | |
parent | 6c6b5b1bc18e16d0b40b674c8a48e0104ec73729 (diff) | |
download | libquotient-81b6d940218a212a37e3c600c66fbe9a7476f433.tar.gz libquotient-81b6d940218a212a37e3c600c66fbe9a7476f433.zip |
Room: Make sure an event with the same id isn't added twice to the timeline; forbid empty event id's
Added assertions and enhanced debug messages along the way
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/roommessagesjob.cpp | 8 | ||||
-rw-r--r-- | jobs/roommessagesjob.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp index 1e53f601..7a0bc756 100644 --- a/jobs/roommessagesjob.cpp +++ b/jobs/roommessagesjob.cpp @@ -28,7 +28,7 @@ class RoomMessagesJob::Private public: Private() {} - Events events; + Owning<Events> events; QString end; }; @@ -49,9 +49,9 @@ RoomMessagesJob::~RoomMessagesJob() delete d; } -Events RoomMessagesJob::events() +Events RoomMessagesJob::releaseEvents() { - return d->events; + return d->events.release(); } QString RoomMessagesJob::end() @@ -62,7 +62,7 @@ QString RoomMessagesJob::end() BaseJob::Status RoomMessagesJob::parseJson(const QJsonDocument& data) { QJsonObject obj = data.object(); - d->events = eventsFromJson(obj.value("chunk").toArray()); + d->events.assign(eventsFromJson(obj.value("chunk").toArray())); d->end = obj.value("end").toString(); return Success; } diff --git a/jobs/roommessagesjob.h b/jobs/roommessagesjob.h index 348217cc..fd6a131d 100644 --- a/jobs/roommessagesjob.h +++ b/jobs/roommessagesjob.h @@ -35,7 +35,7 @@ namespace QMatrixClient FetchDirectory dir = FetchDirectory::Backwards, int limit=10); virtual ~RoomMessagesJob(); - Events events(); + Events releaseEvents(); QString end(); protected: |