Comment: | Adjust to ObjFW changes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e597cc80e1537bae3544bccd7b55dbdf |
User & Date: | js on 2021-04-29 00:32:30 |
Other Links: | manifest | tags |
2024-07-15
| ||
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 | |
2020-10-31
| ||
19:37 | Adjust to ObjFW changes check-in: 6b6fe6d802 user: js tags: trunk | |
Modified extra.mk.in from [ce5a64be0d] to [6c390c751b].
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | - + | OBJMATRIX_SHARED_LIB = @OBJMATRIX_SHARED_LIB@ OBJMATRIX_STATIC_LIB = @OBJMATRIX_STATIC_LIB@ OBJMATRIX_FRAMEWORK = @OBJMATRIX_FRAMEWORK@ OBJMATRIX_LIB_MAJOR = 0 OBJMATRIX_LIB_MINOR = 0 |
︙ |
Modified src/MTXClient.h from [4640a34e7e] to [fc371d6d5c].
︙ | |||
30 31 32 33 34 35 36 | 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 | - + - + - + - - + + - + | /** * @brief A block called when a new login succeeded or failed. * * @param client If the login succeeded, the newly created client * @param exception If the login failed, an exception */ |
︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | - + - + - | @property (readonly, nonatomic) id <MTXStorage> storage; /** * @brief The timeout for sync requests. * * Defaults to 5 minutes. */ |
︙ | |||
138 139 140 141 142 143 144 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + | * @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 storage: (id <MTXStorage>)storage |
︙ | |||
178 179 180 181 182 183 184 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - + - + - + - - + - - + | /** * @brief Logs out the device and invalidates the access token. * * @warning The client can no longer be used after this succeeded! * * @param block A block to call when logging out succeeded or failed */ |
Modified src/MTXClient.m from [90a5b4b816] to [6d2f252461].
︙ | |||
65 66 67 68 69 70 71 | 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 | - + - + - + | storage: storage] autorelease]; } + (void)logInWithUser: (OFString *)user password: (OFString *)password homeserver: (OFURL *)homeserver storage: (id <MTXStorage>)storage |
︙ | |||
213 214 215 216 217 218 219 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - + | 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; |
︙ | |||
271 272 273 274 275 276 277 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | - + - - + + - + - + | } - (void)stopSyncLoop { _syncing = false; } |
︙ | |||
337 338 339 340 341 342 343 | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | - + - - - + + | block(response[@"joined_rooms"], nil); }]; objc_autoreleasePoolPop(pool); } |
︙ | |||
372 373 374 375 376 377 378 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | - + - - - + + | block(roomID, nil); }]; objc_autoreleasePoolPop(pool); } |
︙ | |||
403 404 405 406 407 408 409 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | - + - + - + | }]; objc_autoreleasePoolPop(pool); } - (void)sendMessage: (OFString *)message roomID: (OFString *)roomID |
︙ | |||
462 463 464 465 466 467 468 | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | - + - - + - | - (void)processJoinedRooms: (OFDictionary<OFString *, id> *)rooms { if (rooms == nil) return; for (OFString *roomID in rooms) |
Modified src/MTXRequest.h from [a3c3ccbf3a] to [df12428c28].
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + - - + + | OF_ASSUME_NONNULL_BEGIN /** * @brief A response to a request. * * This is a typedef for `OFDictionary<OFString *, id> *`. */ |
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | - + | @property (readonly, nonatomic) OFURL *homeserver; /** * @brief The HTTP request method. * * Defaults to `OF_HTTP_REQUEST_METHOD_GET`. */ |
︙ | |||
108 109 110 111 112 113 114 | 108 109 110 111 112 113 114 115 116 117 118 | - + | /** * @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 */ |
Modified src/MTXRequest.m from [e2e1bfaf11] to [bc5bbe8ab6].
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + | */ #import "MTXRequest.h" @implementation MTXRequest { OFData *_body; |
︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + | { self = [super init]; @try { _accessToken = [accessToken copy]; _homeserver = [homeserver copy]; _path = [path copy]; |
︙ | |||
69 70 71 72 73 74 75 | 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 | - + - - + - + - - + | - (void)setBody: (OFDictionary<OFString *, id> *)body { void *pool = objc_autoreleasePoolPush(); [_body release]; OFString *JSONString = [body JSONRepresentation]; |
︙ | |||
127 128 129 130 131 132 133 | 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 | - + - + - - + | exception: (id)exception { if (response != nil && [exception isKindOfClass: [OFHTTPRequestFailedException class]]) exception = nil; /* Reset to nil first, so that another one can be performed. */ |
︙ |
Modified src/MTXSQLite3Storage.m from [28eaed72b7] to [271ad345ab].
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | - + - + - | @"CREATE TABLE IF NOT EXISTS joined_rooms (\n" @" user_id TEXT,\n" @" room_id TEXT,\n" @" PRIMARY KEY (user_id, room_id)\n" @");"]; } |
︙ | |||
142 143 144 145 146 147 148 | 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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | - + - - + - - + - - | [_nextBatchGetStatement.rowDictionary[@"next_batch"] retain]; objc_autoreleasePoolPop(pool); return [nextBatch autorelease]; } |
Modified src/MTXStorage.h from [aaa9d2df3c] to [c5b7a2e904].
︙ | |||
26 27 28 29 30 31 32 | 26 27 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 78 79 80 81 82 83 84 85 86 87 88 | - + - + - + - - + - - + - | /** * @brief A block which will be treated as a single transaction for the storage. * * @return Whether the transaction should be committed (`true`) or rolled back * (`false`). */ |
Modified src/exceptions/MTXClientException.h from [f343668f2c] to [9ee1fc88b6].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + - + | OF_ASSUME_NONNULL_BEGIN @class MTXClient; @interface MTXClientException: OFException @property (readonly, nonatomic) int statusCode; |
Modified src/exceptions/MTXClientException.m from [2fdf4e0536] to [1e9caf8ec1].
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + | #import "MTXLogoutFailedException.h" #import "MTXClient.h" @implementation MTXClientException + (instancetype)exceptionWithStatusCode: (int)statusCode |
︙ |
Modified src/exceptions/MTXJoinRoomFailedException.h from [c24a689f7d] to [0427dc1ac2].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + - + - + | OF_ASSUME_NONNULL_BEGIN @interface MTXJoinRoomFailedException: MTXClientException @property (readonly, nonatomic) OFString *room; + (instancetype)exceptionWithStatusCode: (int)statusCode |
Modified src/exceptions/MTXJoinRoomFailedException.m from [6d2b4b0f4f] to [03f637a24d].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + | #import "MTXJoinRoomFailedException.h" #import "MTXClient.h" @implementation MTXJoinRoomFailedException + (instancetype)exceptionWithRoom: (OFString *)room statusCode: (int)statusCode |
︙ |
Modified src/exceptions/MTXLeaveRoomFailedException.h from [0d2a38a4ba] to [e5d31b0687].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + - + - + | OF_ASSUME_NONNULL_BEGIN @interface MTXLeaveRoomFailedException: MTXClientException @property (readonly, nonatomic) OFString *roomID; + (instancetype)exceptionWithStatusCode: (int)statusCode |
Modified src/exceptions/MTXLeaveRoomFailedException.m from [1ab07a8b06] to [9c73667da3].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + | #import "MTXLeaveRoomFailedException.h" #import "MTXClient.h" @implementation MTXLeaveRoomFailedException + (instancetype)exceptionWithRoomID: (OFString *)roomID statusCode: (int)statusCode |
︙ |
Modified src/exceptions/MTXLoginFailedException.h from [652862dea6] to [292e0da216].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + - + | OF_ASSUME_NONNULL_BEGIN @interface MTXLoginFailedException: OFException @property (readonly, nonatomic) OFString *user; @property (readonly, nonatomic) OFURL *homeserver; @property (readonly, nonatomic) int statusCode; |
Modified src/exceptions/MTXLoginFailedException.m from [9df3447195] to [66dad95c01].
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + - + | #import "MTXLoginFailedException.h" @implementation MTXLoginFailedException + (instancetype)exceptionWithUser: (OFString *)user homeserver: (OFURL *)homeserver statusCode: (int)statusCode |
︙ |
Modified src/exceptions/MTXSendMessageFailedException.h from [d7a7a80695] to [3cec6313dc].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + - + - + - + | OF_ASSUME_NONNULL_BEGIN @interface MTXSendMessageFailedException: MTXClientException @property (readonly, nonatomic) OFString *message; @property (readonly, nonatomic) OFString *roomID; + (instancetype)exceptionWithStatusCode: (int)statusCode |
Modified src/exceptions/MTXSendMessageFailedException.m from [4d0e5a29bd] to [7a18d8f50a].
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + - + | #import "MTXClient.h" @implementation MTXSendMessageFailedException + (instancetype)exceptionWithMessage: (OFString *)message roomID: (OFString *)roomID statusCode: (int)statusCode |
︙ |
Modified tests/tests.m from [bf6cef9450] to [16dc45e5ea].
︙ | |||
37 38 39 40 41 42 43 | 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 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 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 | - - - + + + - + - + - + - + - - + - + - + - + - + - - + - + - - + - - + - + - + - + | - (void)applicationDidFinishLaunching { __auto_type environment = OFApplication.environment; if (environment[@"OBJMATRIX_USER"] == nil || environment[@"OBJMATRIX_PASS"] == nil || environment[@"OBJMATRIX_HS"] == nil) { |