aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-11-23 19:20:45 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-08 20:12:25 +0900
commita0053484024a85ae47dcd2b464cb15c0f85109e5 (patch)
tree200ece411a5aeb72fea518c238f784f2ccccf92b /lib/jobs
parent9628594881346c8e06594e65d3befafc310e12d5 (diff)
downloadlibquotient-a0053484024a85ae47dcd2b464cb15c0f85109e5.tar.gz
libquotient-a0053484024a85ae47dcd2b464cb15c0f85109e5.zip
SyncJob: accept Filter instead of QString for the filter
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/syncjob.cpp7
-rw-r--r--lib/jobs/syncjob.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/jobs/syncjob.cpp b/lib/jobs/syncjob.cpp
index ac0f6685..84385b55 100644
--- a/lib/jobs/syncjob.cpp
+++ b/lib/jobs/syncjob.cpp
@@ -42,6 +42,13 @@ SyncJob::SyncJob(const QString& since, const QString& filter, int timeout,
setMaxRetries(std::numeric_limits<int>::max());
}
+SyncJob::SyncJob(const QString& since, const Filter& filter,
+ int timeout, const QString& presence)
+ : SyncJob(since,
+ QJsonDocument(toJson(filter)).toJson(QJsonDocument::Compact),
+ timeout, presence)
+{ }
+
BaseJob::Status SyncJob::parseJson(const QJsonDocument& data)
{
d.parseJson(data.object());
diff --git a/lib/jobs/syncjob.h b/lib/jobs/syncjob.h
index a0a3c026..036b25d0 100644
--- a/lib/jobs/syncjob.h
+++ b/lib/jobs/syncjob.h
@@ -21,6 +21,7 @@
#include "basejob.h"
#include "../syncdata.h"
+#include "../csapi/definitions/sync_filter.h"
namespace QMatrixClient
{
@@ -30,6 +31,8 @@ namespace QMatrixClient
explicit SyncJob(const QString& since = {},
const QString& filter = {},
int timeout = -1, const QString& presence = {});
+ explicit SyncJob(const QString& since, const Filter& filter,
+ int timeout = -1, const QString& presence = {});
SyncData &&takeData() { return std::move(d); }