aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-05-25 19:45:15 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-05-26 10:47:44 +0900
commitfab6c26770827ce2b8ed8f5d06b3677b75a19cec (patch)
tree2487f1432c45829b152e7481077ad0fb08748aa6 /jobs
parent1cd8802c73ee3c0cc0095f8be30a9bbf3442c3ca (diff)
downloadlibquotient-fab6c26770827ce2b8ed8f5d06b3677b75a19cec.tar.gz
libquotient-fab6c26770827ce2b8ed8f5d06b3677b75a19cec.zip
Introducing EventList class + minor fix
Now you can parse a JSON array into a list of events with a one-liner. Also, fromMSecsSinceEpoch accepts a qint64, not quint64 - fixed the respective cast.
Diffstat (limited to 'jobs')
-rw-r--r--jobs/roommessagesjob.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp
index fc3f5f1e..5a97cc23 100644
--- a/jobs/roommessagesjob.cpp
+++ b/jobs/roommessagesjob.cpp
@@ -84,12 +84,7 @@ QUrlQuery RoomMessagesJob::query()
void RoomMessagesJob::parseJson(const QJsonDocument& data)
{
QJsonObject obj = data.object();
- QJsonArray chunk = obj.value("chunk").toArray();
- for( const QJsonValue& val: chunk )
- {
- Event* event = Event::fromJson(val.toObject());
- d->events.append(event);
- }
+ d->events = eventListFromJson(obj.value("chunk").toArray());
d->end = obj.value("end").toString();
emitResult();
-} \ No newline at end of file
+}