Skip to content

Commit 1be8b42

Browse files
committed
refactor(ffi): expose privileged_creators_role in the FFI RoomInfo
1 parent 7a5f83f commit 1be8b42

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

bindings/matrix-sdk-ffi/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ All notable changes to this project will be documented in this file.
88

99
### Features:
1010

11+
- Add `room_version` and `privileged_creators_role` to `RoomInfo` ([#5449](https://github.com/matrix-org/matrix-rust-sdk/pull/5449)).
1112
- The [`unstable-hydra`] feature has been enabled, which enables room v12 changes in the SDK.
12-
[(#5450)](https://github.com/matrix-org/matrix-rust-sdk/pull/5450).
13+
([#5450](https://github.com/matrix-org/matrix-rust-sdk/pull/5450)).
1314
- Add experimental support for
1415
[MSC4306](https://github.com/matrix-org/matrix-spec-proposals/pull/4306), with the
1516
`Room::fetch_thread_subscription()` and `Room::set_thread_subscription()` methods.

bindings/matrix-sdk-ffi/src/room/room_info.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ pub struct RoomInfo {
7676
power_levels: Option<Arc<RoomPowerLevels>>,
7777
/// This room's version.
7878
room_version: Option<String>,
79+
/// Whether creators are privileged over every other user (have infinite
80+
/// power level).
81+
privileged_creators_role: bool,
7982
}
8083

8184
impl RoomInfo {
@@ -155,6 +158,11 @@ impl RoomInfo {
155158
history_visibility: room.history_visibility_or_default().try_into()?,
156159
power_levels: power_levels.map(Arc::new),
157160
room_version: room.version().map(|version| version.to_string()),
161+
privileged_creators_role: room
162+
.version()
163+
.and_then(|version| version.rules())
164+
.map(|rules| rules.authorization.explicitly_privilege_room_creators)
165+
.unwrap_or_default(),
158166
})
159167
}
160168
}

0 commit comments

Comments
 (0)