Skip to content

Commit

Permalink
SyncJob: accept Filter instead of QString for the filter
Browse files Browse the repository at this point in the history
  • Loading branch information
KitsuneRal committed Dec 8, 2018
1 parent 9628594 commit a005348
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/jobs/syncjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions lib/jobs/syncjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "basejob.h"

#include "../syncdata.h"
#include "../csapi/definitions/sync_filter.h"

namespace QMatrixClient
{
Expand All @@ -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); }

Expand Down

0 comments on commit a005348

Please sign in to comment.