mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-06 15:04:11 -04:00
Expose accept_invitation to UniFFI
This commit is contained in:
@@ -266,6 +266,9 @@ interface Room {
|
||||
[Throws=ClientError]
|
||||
void reject_invitation();
|
||||
|
||||
[Throws=ClientError]
|
||||
void accept_invitation();
|
||||
|
||||
[Throws=ClientError]
|
||||
void set_topic(string topic);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user