@@ -34,15 +34,15 @@ */ 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. * * @param rooms An array of joined rooms, or nil on error @@ -59,17 +59,10 @@ * @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 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. */ @interface MTXClient: OFObject /** @@ -131,11 +124,11 @@ * * @warning The client can no longer be used after this succeeded! * * @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. * * @param block A block to call with the list of joined room @@ -156,9 +149,20 @@ * * @param roomID The room ID to leave * @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