ObjMatrix  Check-in [531eb84cf5]

Overview
Comment:Adjust to ObjFW changes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 531eb84cf5c27b39f7701dfa446886e2962aad9a8b60c3623e3b70833b18c592
User & Date: js on 2024-07-15 20:31:53
Other Links: manifest | tags
Context
2024-07-15
20:52
Update buildsys check-in: 49376442c6 user: js tags: trunk
20:31
Adjust to ObjFW changes check-in: 531eb84cf5 user: js tags: trunk
2021-04-29
00:32
Adjust to ObjFW changes check-in: e597cc80e1 user: js tags: trunk
Changes

Modified ObjMatrix.oc from [b6196c65e4] to [eacab392f9].

1
2

3
4
5
1

2
3
4
5

-
+



package_format 1
package_depends_on ObjOpenSSL
package_depends_on ObjFWTLS
package_depends_on ObjSQLite3
LIBS="-lobjmatrix $LIBS"
FRAMEWORK_LIBS="-framework ObjMatrix $FRAMEWORK_LIBS"

Modified README.md from [a1d3dbcd6f] to [6a0d47f66d].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11

12

13
14
15
16
17
18
19

20
21
22
23
24
25
26
27











-
+
-







-
+







# ObjMatrix

## What is ObjMatrix?

ObjMatrix is a [Matrix](https://matrix.org) client library for
[ObjFW](https://objfw.nil.im).

It is currently in early development stages.

## How to build it?

You need [ObjFW](https://objfw.nil.im),
You need [ObjFW](https://objfw.nil.im) and
[ObjOpenSSL](https://fossil.nil.im/objopenssl) and
[ObjSQLite3](https://fossil.nil.im/objsqlite3) installed in order to do this.

ObjMatrix uses modern Objective-C, and hence cannot be compiled with GCC, but
only with Clang. So install Clang first and ObjFW will automatically pick it up.

You can install them all like this:

    $ for i in objfw objopenssl objsqlite3 objmatrix; do
    $ for i in objfw objsqlite3 objmatrix; do
          fossil clone https://fossil.nil.im/$i $i.fossil &&
          mkdir $i &&
          cd $i &&
          fossil open ../$i.fossil &&
          ./autogen.sh &&
          ./configure &&
          make &&

Modified configure.ac from [d887e5a7de] to [24805d345c].

12
13
14
15
16
17
18
19
20


21
22

23
24
25
26
27
28
29
12
13
14
15
16
17
18


19
20
21

22
23
24
25
26
27
28
29







-
-
+
+

-
+







BUILDSYS_INIT

AC_CHECK_TOOL(OBJFW_CONFIG, objfw-config)
AS_IF([test x"$OBJFW_CONFIG" = x""], [
	AC_MSG_ERROR(You need ObjFW and objfw-config installed!)
])

AS_IF([$OBJFW_CONFIG --package ObjOpenSSL], [
	OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjOpenSSL"
AS_IF([$OBJFW_CONFIG --package ObjFWTLS], [
	OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjFWTLS"
], [
	AC_MSG_ERROR(ObjOpenSSL not found!)
	AC_MSG_ERROR(ObjFWTLS not found!)
])
AS_IF([$OBJFW_CONFIG --package ObjSQLite3], [
	OBJFW_CONFIG_FLAGS="$OBJFW_CONFIG_FLAGS --package ObjSQLite3"
], [
	AC_MSG_ERROR(ObjSQLite3 not found!)
])

Modified src/MTXClient.h from [fc371d6d5c] to [52edd40171].

88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102







-
+







 * @brief The access token used by the client.
 */
@property (readonly, nonatomic) OFString *accessToken;

/**
 * @brief The homeserver used by the client.
 */
@property (readonly, nonatomic) OFURL *homeserver;
@property (readonly, nonatomic) OFIRI *homeserver;

/**
 * @brief The storage used by the client.
 */
@property (readonly, nonatomic) id <MTXStorage> storage;

/**
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128

129
130
131
132
133
134
135
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160

161
162
163
164
165
166
167
114
115
116
117
118
119
120

121
122
123
124
125
126
127

128
129
130
131
132
133
134
135
136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159

160
161
162
163
164
165
166
167







-
+






-
+













-
+










-
+






-
+







/**
 * @brief Creates a new client with the specified access token on the specified
 *	  homeserver.
 *
 * @param userID The user ID for the client
 * @param deviceID The device ID for the client
 * @param accessToken The access token for the client
 * @param homeserver The URL of the homeserver
 * @param homeserver The IRI of the homeserver
 * @param storage The storage the client should use
 * @return An autoreleased MTXClient
 */
+ (instancetype)clientWithUserID: (OFString *)userID
			deviceID: (OFString *)deviceID
		     accessToken: (OFString *)accessToken
		      homeserver: (OFURL *)homeserver
		      homeserver: (OFIRI *)homeserver
			 storage: (id <MTXStorage>)storage;

/**
 * @brief Logs into the homeserver and creates a new client.
 *
 * @param user The user to log into
 * @param password The password to log in with
 * @param homeserver The homeserver to log into
 * @param storage The storage the client should use
 * @param block A block to call once login succeeded or failed
 */
+ (void)logInWithUser: (OFString *)user
	     password: (OFString *)password
	   homeserver: (OFURL *)homeserver
	   homeserver: (OFIRI *)homeserver
	      storage: (id <MTXStorage>)storage
		block: (MTXClientLoginBlock)block;

/**
 * @brief Initializes an already allocated client with the specified access
 *	  token on the specified homeserver.
 *
 * @param userID The user ID for the client
 * @param deviceID The device ID for the client
 * @param accessToken The access token for the client
 * @param homeserver The URL of the homeserver
 * @param homeserver The IRI of the homeserver
 * @param storage The storage the client should use
 * @return An initialized MTXClient
 */
- (instancetype)initWithUserID: (OFString *)userID
		      deviceID: (OFString *)deviceID
		   accessToken: (OFString *)accessToken
		    homeserver: (OFURL *)homeserver
		    homeserver: (OFIRI *)homeserver
		       storage: (id <MTXStorage>)storage
    OF_DESIGNATED_INITIALIZER;

/**
 * @brief Starts the sync loop.
 */
- (void)startSyncLoop;

Modified src/MTXClient.m from [6d2f252461] to [df900b474a].

28
29
30
31
32
33
34
35

36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
28
29
30
31
32
33
34

35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77







-
+




-
+

















-
+











-
+







#import "MTXLeaveRoomFailedException.h"
#import "MTXLoginFailedException.h"
#import "MTXLogoutFailedException.h"
#import "MTXSendMessageFailedException.h"
#import "MTXSyncFailedException.h"

static void
validateHomeserver(OFURL *homeserver)
validateHomeserver(OFIRI *homeserver)
{
	if (![homeserver.scheme isEqual: @"http"] &&
	    ![homeserver.scheme isEqual: @"https"])
		@throw [OFUnsupportedProtocolException
		    exceptionWithURL: homeserver];
		    exceptionWithIRI: homeserver];

	if (homeserver.path != nil && ![homeserver.path isEqual: @"/"])
		@throw [OFInvalidArgumentException exception];

	if (homeserver.user != nil || homeserver.password != nil ||
	    homeserver.query != nil || homeserver.fragment != nil)
		@throw [OFInvalidArgumentException exception];
}

@implementation MTXClient
{
	bool _syncing;
}

+ (instancetype)clientWithUserID: (OFString *)userID
			deviceID: (OFString *)deviceID
		     accessToken: (OFString *)accessToken
		      homeserver: (OFURL *)homeserver
		      homeserver: (OFIRI *)homeserver
			 storage: (id <MTXStorage>)storage
{
	return [[[self alloc] initWithUserID: userID
				    deviceID: deviceID
				 accessToken: accessToken
				  homeserver: homeserver
				     storage: storage] autorelease];
}

+ (void)logInWithUser: (OFString *)user
	     password: (OFString *)password
	   homeserver: (OFURL *)homeserver
	   homeserver: (OFIRI *)homeserver
	      storage: (id <MTXStorage>)storage
		block: (MTXClientLoginBlock)block
{
	void *pool = objc_autoreleasePoolPush();

	validateHomeserver(homeserver);

108
109
110
111
112
113
114
115


116
117
118
119

120
121
122
123




124
125
126
127
128


129
130

131
132
133
134
135
136
137
108
109
110
111
112
113
114

115
116
117
118
119

120
121



122
123
124
125
126
127
128


129
130
131

132
133
134
135
136
137
138
139







-
+
+



-
+

-
-
-
+
+
+
+



-
-
+
+

-
+








		OFString *userID = response[@"user_id"];
		OFString *deviceID = response[@"device_id"];
		OFString *accessToken = response[@"access_token"];
		if (![userID isKindOfClass: OFString.class] ||
		    ![deviceID isKindOfClass: OFString.class] ||
		    ![accessToken isKindOfClass: OFString.class]) {
			block(nil, [OFInvalidServerReplyException exception]);
			block(nil,
			    [OFInvalidServerResponseException exception]);
			return;
		}

		OFString *baseURL =
		OFString *baseIRI =
		    response[@"well_known"][@"m.homeserver"][@"base_url"];
		if (baseURL != nil &&
		    ![baseURL isKindOfClass: OFString.class]) {
			block(nil, [OFInvalidServerReplyException exception]);
		if (baseIRI != nil &&
		    ![baseIRI isKindOfClass: OFString.class]) {
			block(nil,
			    [OFInvalidServerResponseException exception]);
			return;
		}

		OFURL *realHomeserver;
		if (baseURL != nil) {
		OFIRI *realHomeserver;
		if (baseIRI != nil) {
			@try {
				realHomeserver = [OFURL URLWithString: baseURL];
				realHomeserver = [OFIRI IRIWithString: baseIRI];
			} @catch (id e) {
				block(nil, e);
				return;
			}
		} else
			realHomeserver = homeserver;

145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
147
148
149
150
151
152
153

154
155
156
157
158
159
160
161







-
+








	objc_autoreleasePoolPop(pool);
}

- (instancetype)initWithUserID: (OFString *)userID
		      deviceID: (OFString *)deviceID
		   accessToken: (OFString *)accessToken
		    homeserver: (OFURL *)homeserver
		    homeserver: (OFIRI *)homeserver
		       storage: (id <MTXStorage>)storage
{
	self = [super init];

	@try {
		validateHomeserver(homeserver);

208
209
210
211
212
213
214
215
216
217
218
219














220
221
222
223
224
225
226
210
211
212
213
214
215
216





217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237







-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+








	_syncing = true;

	void *pool = objc_autoreleasePoolPush();
	MTXRequest *request = [self
	    requestWithPath: @"/_matrix/client/r0/sync"];
	unsigned long long timeoutMs = _syncTimeout * 1000;
	OFMutableDictionary<OFString *, OFString *> *query =
	    [OFMutableDictionary dictionaryWithObject: @(timeoutMs).stringValue
					       forKey: @"timeout"];
	query[@"since"] = [_storage nextBatchForDeviceID: _deviceID];
	request.query = query;
	OFMutableArray<OFPair <OFString *, OFString *> *> *queryItems =
	    [OFMutableArray array];
	OFString *since = [_storage nextBatchForDeviceID: _deviceID];

	[queryItems addObject:
	    [OFPair pairWithFirstObject: @"timeout"
			   secondObject: @(timeoutMs).stringValue]];

	if (since != nil)
		[queryItems addObject:
		    [OFPair pairWithFirstObject: @"since"
				   secondObject: since]];

	request.queryItems = queryItems;
	[request performWithBlock: ^ (MTXResponse response, int statusCode,
				       id exception) {
		if (exception != nil) {
			if (_syncExceptionHandler != NULL)
				_syncExceptionHandler(exception);
			return;
		}
234
235
236
237
238
239
240
241


242
243
244
245
246
247
248
245
246
247
248
249
250
251

252
253
254
255
256
257
258
259
260







-
+
+







			return;
		}

		OFString *nextBatch = response[@"next_batch"];
		if (![nextBatch isKindOfClass: OFString.class]) {
			if (_syncExceptionHandler != NULL)
				_syncExceptionHandler(
				    [OFInvalidServerReplyException exception]);
				    [OFInvalidServerResponseException
				    exception]);
			return;
		}

		@try {
			[_storage transactionWithBlock: ^ {
				[_storage setNextBatch: nextBatch
					   forDeviceID: _deviceID];
320
321
322
323
324
325
326
327


328
329
330
331
332
333


334
335
336
337
338
339
340
332
333
334
335
336
337
338

339
340
341
342
343
344
345

346
347
348
349
350
351
352
353
354







-
+
+





-
+
+







					   response: response
					     client: self]);
			return;
		}

		OFArray<OFString *> *joinedRooms = response[@"joined_rooms"];
		if (![joinedRooms isKindOfClass: OFArray.class]) {
			block(nil, [OFInvalidServerReplyException exception]);
			block(nil,
			    [OFInvalidServerResponseException exception]);
			return;
		}
		for (OFString *room in joinedRooms) {
			if (![room isKindOfClass: OFString.class]) {
				block(nil,
				    [OFInvalidServerReplyException exception]);
				    [OFInvalidServerResponseException
				    exception]);
				return;
			}
		}

		block(response[@"joined_rooms"], nil);
	}];

361
362
363
364
365
366
367
368


369
370
371
372
373
374
375
375
376
377
378
379
380
381

382
383
384
385
386
387
388
389
390







-
+
+







				     response: response
				       client: self]);
			return;
		}

		OFString *roomID = response[@"room_id"];
		if (![roomID isKindOfClass: OFString.class]) {
			block(nil, [OFInvalidServerReplyException exception]);
			block(nil,
			    [OFInvalidServerResponseException exception]);
			return;
		}

		block(roomID, nil);
	}];

	objc_autoreleasePoolPop(pool);

Modified src/MTXRequest.h from [df12428c28] to [fe898d27e4].

50
51
52
53
54
55
56
57

58
59

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
50
51
52
53
54
55
56

57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

74
75
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118







-
+

-
+














-
+


-
+

















-
+











-
+











 * @brief The access token to use.
 *
 * Some requests are unauthenticated - for those, the access token is `nil`.
 */
@property (readonly, nonatomic, nullable) OFString *accessToken;

/**
 * @brief The URL of the homeserver to send the request to.
 * @brief The IRI of the homeserver to send the request to.
 */
@property (readonly, nonatomic) OFURL *homeserver;
@property (readonly, nonatomic) OFIRI *homeserver;

/**
 * @brief The HTTP request method.
 *
 * Defaults to `OF_HTTP_REQUEST_METHOD_GET`.
 */
@property (nonatomic) OFHTTPRequestMethod method;

/**
 * @brief The path of the request.
 */
@property (copy, nonatomic) OFString *path;

/**
 * @brief The query for the request.
 * @brief The query items for the request.
 */
@property (copy, nullable, nonatomic)
    OFDictionary<OFString *, OFString *> *query;
    OFArray<OFPair<OFString *, OFString *> *> *queryItems;

/**
 * @brief An optional body to send along with the request.
 *
 * This is a dictionary that gets serialized to JSON when the request is sent.
 */
@property (copy, nullable, nonatomic) OFDictionary<OFString *, id> *body;

/**
 * @brief Creates a new request with the specified access token and homeserver.
 *
 * @param accessToken An (optional) access token to use
 * @param homeserver The homeserver the request will be sent to
 * @return An autoreleased MTXRequest
 */
+ (instancetype)requestWithPath: (OFString *)path
		    accessToken: (nullable OFString *)accessToken
		     homeserver: (OFURL *)homeserver;
		     homeserver: (OFIRI *)homeserver;

/**
 * @brief Initializes an already allocated request with the specified access
 *	  token and homeserver.
 *
 * @param accessToken An (optional) access token to use
 * @param homeserver The homeserver the request will be sent to
 * @return An initialized MTXRequest
 */
- (instancetype)initWithPath: (OFString *)path
		 accessToken: (nullable OFString *)accessToken
		  homeserver: (OFURL *)homeserver;
		  homeserver: (OFIRI *)homeserver;

/**
 * @brief Performs the request and calls the specified block once the request
 *	  succeeded or failed.
 *
 * @param block The block to call once the request succeeded or failed
 */
- (void)performWithBlock: (MTXRequestBlock)block;
@end

OF_ASSUME_NONNULL_END

Modified src/MTXRequest.m from [bc5bbe8ab6] to [7ace3a8218].

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49







-
+








-
+







{
	OFData *_body;
	MTXRequestBlock _block;
}

+ (instancetype)requestWithPath: (OFString *)path
		    accessToken: (OFString *)accessToken
		     homeserver: (OFURL *)homeserver
		     homeserver: (OFIRI *)homeserver
{
	return [[[self alloc] initWithPath: path
			       accessToken: accessToken
				homeserver: homeserver] autorelease];
}

- (instancetype)initWithPath: (OFString *)path
		 accessToken: (OFString *)accessToken
		  homeserver: (OFURL *)homeserver
		  homeserver: (OFIRI *)homeserver
{
	self = [super init];

	@try {
		_accessToken = [accessToken copy];
		_homeserver = [homeserver copy];
		_path = [path copy];
87
88
89
90
91
92
93
94

95
96
97
98



99
100
101
102
103
104
105
106
107
108

109
110
111
112
113
114
115
87
88
89
90
91
92
93

94
95



96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115







-
+

-
-
-
+
+
+









-
+








- (void)performWithBlock: (MTXRequestBlock)block
{
	void *pool = objc_autoreleasePoolPush();

	if (_block != nil)
		/* Not the best exception to indicate it's already in-flight. */
		@throw [OFAlreadyConnectedException exception];
		@throw [OFAlreadyOpenException exceptionWithObject: self];

	OFMutableURL *requestURL = [[_homeserver mutableCopy] autorelease];
	requestURL.path = _path;
	requestURL.queryDictionary = _query;
	OFMutableIRI *requestIRI = [[_homeserver mutableCopy] autorelease];
	requestIRI.path = _path;
	requestIRI.queryItems = _queryItems;

	OFMutableDictionary *headers = [OFMutableDictionary dictionary];
	headers[@"User-Agent"] = @"ObjMatrix";
	if (_accessToken != nil)
		headers[@"Authorization"] =
		    [OFString stringWithFormat: @"Bearer %@", _accessToken];
	if (_body != nil)
		headers[@"Content-Length"] = @(_body.count).stringValue;

	OFHTTPRequest *request = [OFHTTPRequest requestWithURL: requestURL];
	OFHTTPRequest *request = [OFHTTPRequest requestWithIRI: requestIRI];
	request.method = _method;
	request.headers = headers;

	OFHTTPClient *client = [OFHTTPClient client];
	client.delegate = self;

	_block = [block copy];

Modified src/exceptions/MTXLoginFailedException.h from [292e0da216] to [288cda9823].

24
25
26
27
28
29
30
31

32
33
34
35
36

37
38
39
40

41
42
43
44
45
24
25
26
27
28
29
30

31
32
33
34
35

36
37
38
39

40
41
42
43
44
45







-
+




-
+



-
+






#import "MTXRequest.h"

OF_ASSUME_NONNULL_BEGIN

@interface MTXLoginFailedException: OFException
@property (readonly, nonatomic) OFString *user;
@property (readonly, nonatomic) OFURL *homeserver;
@property (readonly, nonatomic) OFIRI *homeserver;
@property (readonly, nonatomic) int statusCode;
@property (readonly, nonatomic) MTXResponse response;

+ (instancetype)exceptionWithUser: (OFString *)user
		       homeserver: (OFURL *)homeserver
		       homeserver: (OFIRI *)homeserver
		       statusCode: (int)statusCode
			 response: (MTXResponse)response;
- (instancetype)initWithUser: (OFString *)user
		  homeserver: (OFURL *)homeserver
		  homeserver: (OFIRI *)homeserver
		  statusCode: (int)statusCode
		    response: (MTXResponse)response;
@end

OF_ASSUME_NONNULL_END

Modified src/exceptions/MTXLoginFailedException.m from [66dad95c01] to [c110a39204].

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45







-
+










-
+







 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "MTXLoginFailedException.h"

@implementation MTXLoginFailedException
+ (instancetype)exceptionWithUser: (OFString *)user
		       homeserver: (OFURL *)homeserver
		       homeserver: (OFIRI *)homeserver
		       statusCode: (int)statusCode
			 response: (MTXResponse)response
{
	return [[[self alloc] initWithUser: user
				homeserver: homeserver
				statusCode: statusCode
				  response: response] autorelease];
}

- (instancetype)initWithUser: (OFString *)user
		  homeserver: (OFURL *)homeserver
		  homeserver: (OFIRI *)homeserver
		  statusCode: (int)statusCode
		    response: (MTXResponse)response
{
	self = [super init];

	@try {
		_user = [user copy];

Renamed and modified tests/tests.m [16dc45e5ea] to tests/Tests.m [53ee119d97].

31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57







-
+











-
+








@implementation Tests
{
	MTXClient *_client;
	OFString *_roomID;
}

- (void)applicationDidFinishLaunching
- (void)applicationDidFinishLaunching: (OFNotification *)notification
{
	__auto_type environment = OFApplication.environment;
	if (environment[@"OBJMATRIX_USER"] == nil ||
	    environment[@"OBJMATRIX_PASS"] == nil ||
	    environment[@"OBJMATRIX_HS"] == nil) {
		[OFStdErr writeString: @"Please set OBJMATRIX_USER, "
				       @"OBJMATRIX_PASS and OBJMATRIX_HS in "
				       @"the environment!\n"];
		[OFApplication terminateWithStatus: 1];
	}

	OFURL *homeserver = [OFURL URLWithString: environment[@"OBJMATRIX_HS"]];
	OFIRI *homeserver = [OFIRI IRIWithString: environment[@"OBJMATRIX_HS"]];
	id <MTXStorage> storage =
	    [MTXSQLite3Storage storageWithPath: @"tests.db"];
	[MTXClient logInWithUser: environment[@"OBJMATRIX_USER"]
			password: environment[@"OBJMATRIX_PASS"]
		      homeserver: homeserver
			 storage: storage
			   block: ^ (MTXClient *client, id exception) {