From 884d033dfb76540dcf5c2228756581de95e1cf5a Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 4 Oct 2020 01:18:14 +0000 Subject: [PATCH] Include "since" in sync FossilOrigin-Name: 2682b2dc32f3396d458e29df26ee65d9a75354c3b28cf4c13eca087cfcf61c38 --- src/MTXClient.m | 6 +++++- src/MTXRequest.h | 3 ++- src/MTXRequest.m | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MTXClient.m b/src/MTXClient.m index 256021d..29f3eb5 100644 --- a/src/MTXClient.m +++ b/src/MTXClient.m @@ -203,7 +203,11 @@ validateHomeserver(OFURL *homeserver) MTXRequest *request = [self requestWithPath: @"/_matrix/client/r0/sync"]; unsigned long long timeoutMs = timeout * 1000; - request.query = [OFString stringWithFormat: @"timeout=%llu", timeoutMs]; + OFMutableDictionary *query = + [OFMutableDictionary dictionaryWithObject: @(timeoutMs).stringValue + forKey: @"timeout"]; + query[@"since"] = [_storage nextBatchForDeviceID: _deviceID]; + request.query = query; [request performWithBlock: ^ (mtx_response_t response, int statusCode, id exception) { if (exception != nil) { diff --git a/src/MTXRequest.h b/src/MTXRequest.h index 5bf3c93..412b3a3 100644 --- a/src/MTXRequest.h +++ b/src/MTXRequest.h @@ -73,7 +73,8 @@ typedef void (^mtx_request_block_t)(mtx_response_t _Nullable response, /** * @brief The query for the request. */ -@property (copy, nullable, nonatomic) OFString *query; +@property (copy, nullable, nonatomic) + OFDictionary *query; /** * @brief An optional body to send along with the request. diff --git a/src/MTXRequest.m b/src/MTXRequest.m index 8f9ec38..c48fbf2 100644 --- a/src/MTXRequest.m +++ b/src/MTXRequest.m @@ -97,7 +97,7 @@ OFMutableURL *requestURL = [[_homeserver mutableCopy] autorelease]; requestURL.path = _path; - requestURL.query = _query; + requestURL.queryDictionary = _query; OFMutableDictionary *headers = [OFMutableDictionary dictionary]; headers[@"User-Agent"] = @"ObjMatrix";