Overview
Comment: | Add support for joining rooms |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b1d8afb546f8999f2c6aba10ca589d2b |
User & Date: | js on 2020-10-03 17:40:47 |
Other Links: | manifest | tags |
Context
2020-10-03
| ||
17:50 | Add support for leaving rooms check-in: 193ebad6ad user: js tags: trunk | |
17:40 | Add support for joining rooms check-in: b1d8afb546 user: js tags: trunk | |
17:23 | Get rid of async prefix check-in: d18fbd29fb user: js tags: trunk | |
Changes
Modified src/MTXClient.h from [4d54398092] to [dc76466324].
︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 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 rooms An array of joined rooms, or nil on error * @param exception An exception if fetching the room list failed */ typedef void (^mtx_client_room_list_block_t)( OFArray<OFString *> *_Nullable rooms, id _Nullable exception); /** * @brief A block called when a room was joined. * * @param roomID The room ID that was joined, or nil on error. This can be used * to get the room ID if a room alias was joined. * @param exception An exception if joining the room failed */ typedef void (^mtx_client_room_join_block_t)(OFString *_Nullable roomID, id _Nullable exception); /** * @brief A class that represents a client. */ @interface MTXClient: OFObject /** * @brief The user ID used by the client. */ |
︙ | |||
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 | + + + + + + + + + | /** * @brief Fetches the list of joined rooms. * * @param block A block to call with the list of joined room */ - (void)fetchRoomListWithBlock: (mtx_client_room_list_block_t)block; /** * @brief Joins the specified room. * * @param room The room to join. Either a room ID or a room alias. * @param block A block to call when the room was joined */ - (void)joinRoom: (OFString *)room block: (mtx_client_room_join_block_t)block; @end OF_ASSUME_NONNULL_END |
Modified src/MTXClient.m from [fbae956347] to [69f2cc536e].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | + | * POSSIBILITY OF SUCH DAMAGE. */ #import "MTXClient.h" #import "MTXRequest.h" #import "MTXFetchRoomListFailedException.h" #import "MTXJoinRoomFailedException.h" #import "MTXLoginFailedException.h" #import "MTXLogoutFailedException.h" static void validateHomeserver(OFURL *homeserver) { if (![homeserver.scheme isEqual: @"http"] && |
︙ | |||
197 198 199 200 201 202 203 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | - - - + + + | if (exception != nil) { block(exception); return; } if (statusCode != 200) { block([MTXLogoutFailedException |
︙ | |||
223 224 225 226 227 228 229 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if (exception != nil) { block(nil, exception); return; } if (statusCode != 200) { block(nil, [MTXFetchRoomListFailedException |
Modified src/exceptions/MTXClientException.h from [1816edf39c] to [f343668f2c].
︙ | |||
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 | - - - + + + - + - - - - - + + + + + + | #import "MTXRequest.h" OF_ASSUME_NONNULL_BEGIN @class MTXClient; @interface MTXClientException: OFException |
Modified src/exceptions/MTXClientException.m from [42e31b0030] to [2fdf4e0536].
︙ | |||
21 22 23 24 25 26 27 | 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + - - + + - + - - + + - - - + + + - + - + | */ #import "MTXLogoutFailedException.h" #import "MTXClient.h" @implementation MTXClientException |
Added src/exceptions/MTXJoinRoomFailedException.h version [c24a689f7d].
Added src/exceptions/MTXJoinRoomFailedException.m version [f939691250].
Modified src/exceptions/Makefile from [390f755e9e] to [219a3de686].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} SRCS = MTXClientException.m \ MTXFetchRoomListFailedException.m \ MTXJoinRoomFailedException.m \ MTXLoginFailedException.m \ MTXLogoutFailedException.m INCLUDES = ${SRCS:.m=.h} include ../../buildsys.mk CPPFLAGS += -I. -I.. |
︙ |
Modified tests/tests.m from [a0b40aeb42] to [8b2bd0de5e].
︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 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 | + + + + + + + + + + + + + + + | if (exception != nil) { of_log(@"Failed to fetch room list: %@", exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Fetched room list: %@", rooms); [self joinRoom]; }]; } - (void)joinRoom { [_client joinRoom: @"#test:nil.im" block: ^ (OFString *roomID, id exception) { if (exception != nil) { of_log(@"Failed to join room: %@", exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Joined room %@", roomID); [self logOut]; }]; } - (void)logOut { [_client logOutWithBlock: ^ (id exception) { |
︙ |