diff --git a/crates/matrix-sdk-base/src/rooms/normal.rs b/crates/matrix-sdk-base/src/rooms/normal.rs index 731dfd220..bdbb9fc81 100644 --- a/crates/matrix-sdk-base/src/rooms/normal.rs +++ b/crates/matrix-sdk-base/src/rooms/normal.rs @@ -26,8 +26,11 @@ use ruma::{ events::{ receipt::Receipt, room::{ - create::CreateEventContent, encryption::EncryptionEventContent, - guest_access::GuestAccess, history_visibility::HistoryVisibility, join_rules::JoinRule, + create::{CreateEventContent, RoomType as CreateRoomType}, + encryption::EncryptionEventContent, + guest_access::GuestAccess, + history_visibility::HistoryVisibility, + join_rules::JoinRule, tombstone::TombstoneEventContent, }, tag::Tags, @@ -130,6 +133,14 @@ impl Room { self.inner.read().unwrap().room_type } + /// Whether this room's [`RoomType`](CreateRoomType) is `m.space`. + pub fn is_space(&self) -> bool { + match self.inner.read().unwrap().base_info.create.as_ref() { + Some(create) => create.room_type == Some(CreateRoomType::Space), + None => false, + } + } + /// Get the unread notification counts. pub fn unread_notification_counts(&self) -> UnreadNotificationsCount { self.inner.read().unwrap().notification_counts