Overview
Comment: | Add support for sending messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cce4e8d73aefdb9a721a42b68b1c769c |
User & Date: | js on 2020-10-03 18:09:38 |
Other Links: | manifest | tags |
Context
2020-10-03
| ||
19:47 | Add support for storage check-in: 3c84d235e5 user: js tags: trunk | |
18:09 | Add support for sending messages check-in: cce4e8d73a user: js tags: trunk | |
17:50 | Add support for leaving rooms check-in: 193ebad6ad user: js tags: trunk | |
Changes
Modified src/MTXClient.h from [0bab750caa] to [b94a3d1693].
︙ | |||
32 33 34 35 36 37 38 | 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 | - + - + - - - - - - - | * @param client If the login succeeded, the newly created client * @param exception If the login failed, an exception */ typedef void (^mtx_client_login_block_t)(MTXClient *_Nullable client, id _Nullable exception); /** |
︙ | |||
129 130 131 132 133 134 135 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - + | /** * @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 */ |
︙ | |||
154 155 156 157 158 159 160 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + + + + + + + + + + + + | /** * @brief Leaves the specified room. * * @param roomID The room ID to leave * @param block A block to call when the room was left */ - (void)leaveRoom: (OFString *)roomID |
Modified src/MTXClient.m from [046c876603] to [654eca2334].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | + | #import "MTXRequest.h" #import "MTXFetchRoomListFailedException.h" #import "MTXJoinRoomFailedException.h" #import "MTXLeaveRoomFailedException.h" #import "MTXLoginFailedException.h" #import "MTXLogoutFailedException.h" #import "MTXSendMessageFailedException.h" static void validateHomeserver(OFURL *homeserver) { if (![homeserver.scheme isEqual: @"http"] && ![homeserver.scheme isEqual: @"https"]) @throw [OFUnsupportedProtocolException |
︙ | |||
184 185 186 187 188 189 190 | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - + | - (MTXRequest *)requestWithPath: (OFString *)path { return [MTXRequest requestWithPath: path accessToken: _accessToken homeserver: _homeserver]; } |
︙ | |||
286 287 288 289 290 291 292 | 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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | block(roomID, nil); }]; objc_autoreleasePoolPop(pool); } - (void)leaveRoom: (OFString *)roomID |
Added src/exceptions/MTXSendMessageFailedException.h version [d7a7a80695].
Added src/exceptions/MTXSendMessageFailedException.m version [2c6af4070c].
Modified src/exceptions/Makefile from [71eab3e5a4] to [21b2ee299e].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - + + | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} SRCS = MTXClientException.m \ MTXFetchRoomListFailedException.m \ MTXJoinRoomFailedException.m \ MTXLeaveRoomFailedException.m \ MTXLoginFailedException.m \ |
Modified tests/tests.m from [c338030dd8] to [fa8fe451a7].
︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 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 | + + + + + + + + + + + + + + + + + | if (exception != nil) { of_log(@"Failed to join room %@: %@", room, exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Joined room %@", roomID); [self sendMessage: roomID]; }]; } - (void)sendMessage: (OFString *)roomID { [_client sendMessage: @"ObjMatrix test successful!" roomID: roomID block: ^ (id exception) { if (exception != nil) { of_log(@"Failed to send message to room %@: %@", roomID, exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Message sent to %@", roomID); [self leaveRoom: roomID]; }]; } - (void)leaveRoom: (OFString *)roomID { [_client leaveRoom: roomID |
︙ |