diff --git a/bindings/matrix-sdk-ffi/src/room_list.rs b/bindings/matrix-sdk-ffi/src/room_list.rs index 9cf93c82d..d4ea7d7fe 100644 --- a/bindings/matrix-sdk-ffi/src/room_list.rs +++ b/bindings/matrix-sdk-ffi/src/room_list.rs @@ -194,6 +194,10 @@ pub struct RoomListItem { #[uniffi::export] impl RoomListItem { + fn id(&self) -> String { + self.inner.id().to_string() + } + fn name(&self) -> Option { RUNTIME.block_on(async { self.inner.name().await }) } diff --git a/crates/matrix-sdk-ui/src/room_list/room.rs b/crates/matrix-sdk-ui/src/room_list/room.rs index 6d5c15963..afa6072a3 100644 --- a/crates/matrix-sdk-ui/src/room_list/room.rs +++ b/crates/matrix-sdk-ui/src/room_list/room.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use async_once_cell::OnceCell as AsyncOnceCell; use matrix_sdk::{SlidingSync, SlidingSyncRoom}; -use ruma::api::client::sync::sync_events::v4::RoomSubscription; +use ruma::{api::client::sync::sync_events::v4::RoomSubscription, RoomId}; use super::Error; use crate::{timeline::EventTimelineItem, Timeline}; @@ -58,6 +58,11 @@ impl Room { }) } + /// Get the room ID. + pub fn id(&self) -> &RoomId { + self.inner.room.room_id() + } + /// Get the best possible name for the room. /// /// If the sliding sync room has received a name from the server, then use