Add support for sending messages

FossilOrigin-Name: cce4e8d73aefdb9a721a42b68b1c769c886d4fdb9a0a45d5bea30f41fe52d237
This commit is contained in:
Jonathan Schleifer 2020-10-03 18:09:38 +00:00
parent 191a6412ae
commit 491d648e3a
6 changed files with 200 additions and 14 deletions

View file

@ -36,11 +36,11 @@ typedef void (^mtx_client_login_block_t)(MTXClient *_Nullable client,
id _Nullable exception);
/**
* @brief A block called when the device was logged out.
* @brief A block called when the response for an operation was received.
*
* @param exception `nil` on success, otherwise an exception
*/
typedef void (^mtx_client_logout_block_t)(id _Nullable exception);
typedef void (^mtx_client_response_block_t)(id _Nullable exception);
/**
* @brief A block called when the room list was fetched.
@ -61,13 +61,6 @@ typedef void (^mtx_client_room_list_block_t)(
typedef void (^mtx_client_room_join_block_t)(OFString *_Nullable roomID,
id _Nullable exception);
/**
* @brief A block called when a room was left.
*
* @param exception An exception if leaving the room failed
*/
typedef void (^mtx_client_room_leave_block_t)(id _Nullable exception);
/**
* @brief A class that represents a client.
*/
@ -133,7 +126,7 @@ typedef void (^mtx_client_room_leave_block_t)(id _Nullable exception);
*
* @param block A block to call when logging out succeeded or failed
*/
- (void)logOutWithBlock: (mtx_client_logout_block_t)block;
- (void)logOutWithBlock: (mtx_client_response_block_t)block;
/**
* @brief Fetches the list of joined rooms.
@ -158,7 +151,18 @@ typedef void (^mtx_client_room_leave_block_t)(id _Nullable exception);
* @param block A block to call when the room was left
*/
- (void)leaveRoom: (OFString *)roomID
block: (mtx_client_room_leave_block_t)block;
block: (mtx_client_response_block_t)block;
/**
* @brief Sends the specified message to the specified room ID.
*
* @param message The message to send
* @param roomID The room ID to which to send the message
* @param block A block to call when the message was sent
*/
- (void)sendMessage: (OFString *)message
roomID: (OFString *)roomID
block: (mtx_client_response_block_t)block;
@end
OF_ASSUME_NONNULL_END