Struct matrix_sdk_base::Room
source · [−]pub struct Room { /* private fields */ }Expand description
The underlying room data structure collecting state for joined, left and invited rooms.
Implementations
sourceimpl Room
impl Room
sourcepub fn own_user_id(&self) -> &UserId
pub fn own_user_id(&self) -> &UserId
Get our own user id.
sourcepub fn unread_notification_counts(&self) -> UnreadNotificationsCount
pub fn unread_notification_counts(&self) -> UnreadNotificationsCount
Get the unread notification counts.
sourcepub fn are_members_synced(&self) -> bool
pub fn are_members_synced(&self) -> bool
Check if the room has it’s members fully synced.
Members might be missing if lazy member loading was enabled for the sync.
Returns true if no members are missing, false otherwise.
sourcepub fn last_prev_batch(&self) -> Option<String>
pub fn last_prev_batch(&self) -> Option<String>
Get the prev_batch token that was received from the last sync. May be
None if the last sync contained the full room history.
sourcepub fn avatar_url(&self) -> Option<OwnedMxcUri>
pub fn avatar_url(&self) -> Option<OwnedMxcUri>
Get the avatar url of this room.
sourcepub fn canonical_alias(&self) -> Option<OwnedRoomAliasId>
pub fn canonical_alias(&self) -> Option<OwnedRoomAliasId>
Get the canonical alias of this room.
sourcepub fn alt_aliases(&self) -> Vec<OwnedRoomAliasId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn alt_aliases(&self) -> Vec<OwnedRoomAliasId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get the canonical alias of this room.
sourcepub fn create_content(&self) -> Option<RoomCreateEventContent>
pub fn create_content(&self) -> Option<RoomCreateEventContent>
Get the m.room.create content of this room.
This usually isn’t optional but some servers might not send an
m.room.create event as the first event for a given room, thus this can
be optional.
It can also be redacted in current room versions, leaving only the
creator field.
sourcepub fn direct_targets(&self) -> HashSet<OwnedUserId>
pub fn direct_targets(&self) -> HashSet<OwnedUserId>
If this room is a direct message, get the members that we’re sharing the room with.
Note: The member list might have been modified in the meantime and the targets might not even be in the room anymore. This setting should only be considered as guidance.
sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Is the room encrypted.
sourcepub fn encryption_settings(&self) -> Option<RoomEncryptionEventContent>
pub fn encryption_settings(&self) -> Option<RoomEncryptionEventContent>
Get the m.room.encryption content that enabled end to end encryption
in the room.
sourcepub fn guest_access(&self) -> GuestAccess
pub fn guest_access(&self) -> GuestAccess
Get the guest access policy of this room.
sourcepub fn history_visibility(&self) -> HistoryVisibility
pub fn history_visibility(&self) -> HistoryVisibility
Get the history visibility policy of this room.
sourcepub fn max_power_level(&self) -> i64
pub fn max_power_level(&self) -> i64
Get the maximum power level that this room contains.
This is useful if one wishes to normalize the power levels, e.g. from 0-100 where 100 would be the max power level.
sourcepub fn is_tombstoned(&self) -> bool
pub fn is_tombstoned(&self) -> bool
Has the room been tombstoned.
sourcepub fn tombstone(&self) -> Option<RoomTombstoneEventContent>
pub fn tombstone(&self) -> Option<RoomTombstoneEventContent>
Get the m.room.tombstone content of this room if there is one.
sourcepub async fn display_name(&self) -> StoreResult<DisplayName>
pub async fn display_name(&self) -> StoreResult<DisplayName>
Calculate the canonical display name of the room, taking into account its name, aliases and members.
The display name is calculated according to this algorithm.
sourcepub async fn joined_user_ids(&self) -> StoreResult<Vec<OwnedUserId>>
pub async fn joined_user_ids(&self) -> StoreResult<Vec<OwnedUserId>>
Get the list of users ids that are considered to be joined members of this room.
sourcepub async fn members(&self) -> StoreResult<Vec<RoomMember>>
pub async fn members(&self) -> StoreResult<Vec<RoomMember>>
Get the all RoomMembers of this room that are known to the store.
sourcepub async fn joined_members(&self) -> StoreResult<Vec<RoomMember>>
pub async fn joined_members(&self) -> StoreResult<Vec<RoomMember>>
Get the list of RoomMembers that are considered to be joined members
of this room.
sourcepub async fn active_members(&self) -> StoreResult<Vec<RoomMember>>
pub async fn active_members(&self) -> StoreResult<Vec<RoomMember>>
Get the list of RoomMembers that are considered to be joined or
invited members of this room.
sourcepub fn clone_info(&self) -> RoomInfo
pub fn clone_info(&self) -> RoomInfo
Clone the inner RoomInfo
sourcepub fn update_summary(&self, summary: RoomInfo)
pub fn update_summary(&self, summary: RoomInfo)
Update the summary with given RoomInfo
sourcepub async fn get_member(
&self,
user_id: &UserId
) -> StoreResult<Option<RoomMember>>
pub async fn get_member(
&self,
user_id: &UserId
) -> StoreResult<Option<RoomMember>>
Get the RoomMember with the given user_id.
Returns None if the member was never part of this room, otherwise
return a RoomMember that can be in a joined, invited, left, banned
state.
Get the Tags for this room.
sourcepub async fn user_read_receipt(
&self,
user_id: &UserId
) -> StoreResult<Option<(OwnedEventId, Receipt)>>
pub async fn user_read_receipt(
&self,
user_id: &UserId
) -> StoreResult<Option<(OwnedEventId, Receipt)>>
Get the read receipt as a EventId and Receipt tuple for the given
user_id in this room.
sourcepub async fn event_read_receipts(
&self,
event_id: &EventId
) -> StoreResult<Vec<(OwnedUserId, Receipt)>>
pub async fn event_read_receipts(
&self,
event_id: &EventId
) -> StoreResult<Vec<(OwnedUserId, Receipt)>>
Get the read receipts as a list of UserId and Receipt tuples for the
given event_id in this room.
sourcepub async fn timeline(
&self
) -> StoreResult<(impl Stream<Item = SyncTimelineEvent>, impl Stream<Item = Result<SyncTimelineEvent, TimelineStreamError>>)>
Available on crate feature experimental-timeline only.
pub async fn timeline(
&self
) -> StoreResult<(impl Stream<Item = SyncTimelineEvent>, impl Stream<Item = Result<SyncTimelineEvent, TimelineStreamError>>)>
experimental-timeline only.Get two stream into the timeline. First one is forward in time and the second one is backward in time.
sourcepub async fn timeline_forward(
&self
) -> StoreResult<impl Stream<Item = SyncTimelineEvent>>
Available on crate feature experimental-timeline only.
pub async fn timeline_forward(
&self
) -> StoreResult<impl Stream<Item = SyncTimelineEvent>>
experimental-timeline only.Create a stream that returns all events of the room’s timeline forward in time.
If you need also a backward stream you should use
timeline
sourcepub async fn timeline_backward(
&self
) -> StoreResult<impl Stream<Item = Result<SyncTimelineEvent, TimelineStreamError>>>
Available on crate feature experimental-timeline only.
pub async fn timeline_backward(
&self
) -> StoreResult<impl Stream<Item = Result<SyncTimelineEvent, TimelineStreamError>>>
experimental-timeline only.Create a stream that returns all events of the room’s timeline backward in time.
If you need also a forward stream you should use
timeline
sourcepub async fn add_timeline_slice(&self, timeline: &TimelineSlice)
Available on crate feature experimental-timeline only.
pub async fn add_timeline_slice(&self, timeline: &TimelineSlice)
experimental-timeline only.Add a new timeline slice to the timeline streams.