From 1be8b42d03e29bcda1bb97034fa278668a5ceb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Mon, 28 Jul 2025 10:34:29 +0200 Subject: [PATCH] refactor(ffi): expose `privileged_creators_role` in the FFI `RoomInfo` --- bindings/matrix-sdk-ffi/CHANGELOG.md | 3 ++- bindings/matrix-sdk-ffi/src/room/room_info.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bindings/matrix-sdk-ffi/CHANGELOG.md b/bindings/matrix-sdk-ffi/CHANGELOG.md index 0bebeac13..06b230558 100644 --- a/bindings/matrix-sdk-ffi/CHANGELOG.md +++ b/bindings/matrix-sdk-ffi/CHANGELOG.md @@ -8,8 +8,9 @@ All notable changes to this project will be documented in this file. ### Features: +- Add `room_version` and `privileged_creators_role` to `RoomInfo` ([#5449](https://github.com/matrix-org/matrix-rust-sdk/pull/5449)). - The [`unstable-hydra`] feature has been enabled, which enables room v12 changes in the SDK. - [(#5450)](https://github.com/matrix-org/matrix-rust-sdk/pull/5450). + ([#5450](https://github.com/matrix-org/matrix-rust-sdk/pull/5450)). - Add experimental support for [MSC4306](https://github.com/matrix-org/matrix-spec-proposals/pull/4306), with the `Room::fetch_thread_subscription()` and `Room::set_thread_subscription()` methods. diff --git a/bindings/matrix-sdk-ffi/src/room/room_info.rs b/bindings/matrix-sdk-ffi/src/room/room_info.rs index 0cb5626ac..8f1534834 100644 --- a/bindings/matrix-sdk-ffi/src/room/room_info.rs +++ b/bindings/matrix-sdk-ffi/src/room/room_info.rs @@ -76,6 +76,9 @@ pub struct RoomInfo { power_levels: Option>, /// This room's version. room_version: Option, + /// Whether creators are privileged over every other user (have infinite + /// power level). + privileged_creators_role: bool, } impl RoomInfo { @@ -155,6 +158,11 @@ impl RoomInfo { history_visibility: room.history_visibility_or_default().try_into()?, power_levels: power_levels.map(Arc::new), room_version: room.version().map(|version| version.to_string()), + privileged_creators_role: room + .version() + .and_then(|version| version.rules()) + .map(|rules| rules.authorization.explicitly_privilege_room_creators) + .unwrap_or_default(), }) } }