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";