Include "since" in sync

FossilOrigin-Name: 2682b2dc32f3396d458e29df26ee65d9a75354c3b28cf4c13eca087cfcf61c38
This commit is contained in:
Jonathan Schleifer 2020-10-04 01:18:14 +00:00
parent d1aa1e3a52
commit 884d033dfb
3 changed files with 8 additions and 3 deletions

View file

@ -203,7 +203,11 @@ validateHomeserver(OFURL *homeserver)
MTXRequest *request = [self MTXRequest *request = [self
requestWithPath: @"/_matrix/client/r0/sync"]; requestWithPath: @"/_matrix/client/r0/sync"];
unsigned long long timeoutMs = timeout * 1000; unsigned long long timeoutMs = timeout * 1000;
request.query = [OFString stringWithFormat: @"timeout=%llu", timeoutMs]; OFMutableDictionary<OFString *, OFString *> *query =
[OFMutableDictionary dictionaryWithObject: @(timeoutMs).stringValue
forKey: @"timeout"];
query[@"since"] = [_storage nextBatchForDeviceID: _deviceID];
request.query = query;
[request performWithBlock: ^ (mtx_response_t response, int statusCode, [request performWithBlock: ^ (mtx_response_t response, int statusCode,
id exception) { id exception) {
if (exception != nil) { if (exception != nil) {

View file

@ -73,7 +73,8 @@ typedef void (^mtx_request_block_t)(mtx_response_t _Nullable response,
/** /**
* @brief The query for the request. * @brief The query for the request.
*/ */
@property (copy, nullable, nonatomic) OFString *query; @property (copy, nullable, nonatomic)
OFDictionary<OFString *, OFString *> *query;
/** /**
* @brief An optional body to send along with the request. * @brief An optional body to send along with the request.

View file

@ -97,7 +97,7 @@
OFMutableURL *requestURL = [[_homeserver mutableCopy] autorelease]; OFMutableURL *requestURL = [[_homeserver mutableCopy] autorelease];
requestURL.path = _path; requestURL.path = _path;
requestURL.query = _query; requestURL.queryDictionary = _query;
OFMutableDictionary *headers = [OFMutableDictionary dictionary]; OFMutableDictionary *headers = [OFMutableDictionary dictionary];
headers[@"User-Agent"] = @"ObjMatrix"; headers[@"User-Agent"] = @"ObjMatrix";