Skip to content

Commit 7a5f83f

Browse files
committed
refactor(ffi): expose room_version in the FFI RoomInfo
1 parent 88bb7a3 commit 7a5f83f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ pub struct RoomInfo {
7474
///
7575
/// Can be missing if the room power levels event is missing from the store.
7676
power_levels: Option<Arc<RoomPowerLevels>>,
77+
/// This room's version.
78+
room_version: Option<String>,
7779
}
7880

7981
impl RoomInfo {
@@ -152,6 +154,7 @@ impl RoomInfo {
152154
join_rule,
153155
history_visibility: room.history_visibility_or_default().try_into()?,
154156
power_levels: power_levels.map(Arc::new),
157+
room_version: room.version().map(|version| version.to_string()),
155158
})
156159
}
157160
}

crates/matrix-sdk-base/src/room/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ pub use room_info::{
4848
RoomInfoNotableUpdateReasons, apply_redaction,
4949
};
5050
use ruma::{
51-
EventId, OwnedEventId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, RoomId, UserId,
51+
EventId, OwnedEventId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, RoomId,
52+
RoomVersionId, UserId,
5253
events::{
5354
direct::OwnedDirectUserIdentifier,
5455
receipt::{Receipt, ReceiptThread, ReceiptType},
@@ -470,6 +471,11 @@ impl Room {
470471
self.inner.read().base_info.is_marked_unread
471472
}
472473

474+
/// Returns the [`RoomVersionId`] of the room, if known.
475+
pub fn version(&self) -> Option<RoomVersionId> {
476+
self.inner.read().room_version().cloned()
477+
}
478+
473479
/// Returns the recency stamp of the room.
474480
///
475481
/// Please read `RoomInfo::recency_stamp` to learn more.

0 commit comments

Comments
 (0)