diff --git a/bindings/matrix-sdk-ffi/src/api.udl b/bindings/matrix-sdk-ffi/src/api.udl index b3f5801f1..565034829 100644 --- a/bindings/matrix-sdk-ffi/src/api.udl +++ b/bindings/matrix-sdk-ffi/src/api.udl @@ -266,6 +266,9 @@ interface Room { [Throws=ClientError] void reject_invitation(); + [Throws=ClientError] + void accept_invitation(); + [Throws=ClientError] void set_topic(string topic); diff --git a/bindings/matrix-sdk-ffi/src/room.rs b/bindings/matrix-sdk-ffi/src/room.rs index c451f727e..bf6e4d765 100644 --- a/bindings/matrix-sdk-ffi/src/room.rs +++ b/bindings/matrix-sdk-ffi/src/room.rs @@ -488,7 +488,7 @@ impl Room { }) } - /// Rejects invitation for the invited room. + /// Rejects the invitation for the invited room. /// /// Will throw an error if used on an room that isn't in an invited state pub fn reject_invitation(&self) -> Result<()> { @@ -503,6 +503,21 @@ impl Room { }) } + /// Accepts the invitation for the invited room. + /// + /// Will throw an error if used on an room that isn't in an invited state + pub fn accept_invitation(&self) -> Result<()> { + let room = match &self.room { + SdkRoom::Invited(i) => i.clone(), + _ => bail!("Can't accept an invite for a room that isn't in invited state"), + }; + + RUNTIME.block_on(async move { + room.accept_invitation().await?; + Ok(()) + }) + } + /// Sets a new topic in the room. pub fn set_topic(&self, topic: String) -> Result<()> { let room = match &self.room {