Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/matrix-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file.

### Features

- Add `room_versions()` & `account_moderation()` to `HomeserverCapabilities`.
([#6413](https://github.com/matrix-org/matrix-rust-sdk/pull/6413))
- Enable sending redaction events through the send queue via `RoomSendQueue::redact`.
This includes local echoes for redaction events through the new `LocalEchoContent::Redaction`
variant.
Expand Down
21 changes: 20 additions & 1 deletion crates/matrix-sdk/src/client/homeserver_capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use matrix_sdk_base::{StateStoreDataKey, StateStoreDataValue};
use ruma::{
api::client::discovery::{
get_capabilities,
get_capabilities::v3::{Capabilities, ProfileFieldsCapability},
get_capabilities::v3::{
AccountModerationCapability, Capabilities, ProfileFieldsCapability,
RoomVersionsCapability,
},
},
profile::ProfileFieldName,
};
Expand Down Expand Up @@ -109,6 +112,22 @@ impl HomeserverCapabilities {
Ok(ProfileFieldsCapability::new(false))
}

/// Returns the room versions supported by the server.
///
/// Spec: <https://spec.matrix.org/latest/client-server-api/#mroom_versions-capability>
pub async fn room_versions(&self) -> crate::Result<RoomVersionsCapability> {
let capabilities = self.load_or_fetch_homeserver_capabilities().await?;
Ok(capabilities.room_versions)
}

/// Returns whether the user can perform account moderation actions.
///
/// Spec: <https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3capabilities_response-200_accountmoderationcapability>
pub async fn account_moderation(&self) -> crate::Result<AccountModerationCapability> {
let capabilities = self.load_or_fetch_homeserver_capabilities().await?;
Ok(capabilities.account_moderation)
}

/// Returns whether or not the server automatically forgets rooms which the
/// user has left.
///
Expand Down
Loading