aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/syncjob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jobs/syncjob.cpp')
-rw-r--r--lib/jobs/syncjob.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/jobs/syncjob.cpp b/lib/jobs/syncjob.cpp
index 84385b55..9087fe50 100644
--- a/lib/jobs/syncjob.cpp
+++ b/lib/jobs/syncjob.cpp
@@ -13,12 +13,12 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "syncjob.h"
-using namespace QMatrixClient;
+using namespace Quotient;
static size_t jobId = 0;
@@ -29,34 +29,33 @@ SyncJob::SyncJob(const QString& since, const QString& filter, int timeout,
{
setLoggingCategory(SYNCJOB);
QUrlQuery query;
- if( !filter.isEmpty() )
+ if (!filter.isEmpty())
query.addQueryItem(QStringLiteral("filter"), filter);
- if( !presence.isEmpty() )
+ if (!presence.isEmpty())
query.addQueryItem(QStringLiteral("set_presence"), presence);
- if( timeout >= 0 )
+ if (timeout >= 0)
query.addQueryItem(QStringLiteral("timeout"), QString::number(timeout));
- if( !since.isEmpty() )
+ if (!since.isEmpty())
query.addQueryItem(QStringLiteral("since"), since);
setRequestQuery(query);
setMaxRetries(std::numeric_limits<int>::max());
}
-SyncJob::SyncJob(const QString& since, const Filter& filter,
- int timeout, const QString& presence)
+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)
+BaseJob::Status SyncJob::prepareResult()
{
- d.parseJson(data.object());
+ d.parseJson(jsonData());
if (d.unresolvedRooms().isEmpty())
- return BaseJob::Success;
+ return Success;
qCCritical(MAIN).noquote() << "Incomplete sync response, missing rooms:"
<< d.unresolvedRooms().join(',');
- return BaseJob::IncorrectResponseError;
+ return IncorrectResponse;
}
-