Struct matrix_sdk_base::Room
source · pub struct Room {
pub latest_encrypted_events: Arc<RwLock<RingBuffer<Raw<AnySyncTimelineEvent>>>>,
/* private fields */
}
Expand description
The underlying room data structure collecting state for joined, left and invited rooms.
Fields§
§latest_encrypted_events: Arc<RwLock<RingBuffer<Raw<AnySyncTimelineEvent>>>>
e2e-encryption
and experimental-sliding-sync
only.The most recent few encrypted events. When the keys come through to
decrypt these, the most recent relevant one will replace
latest_event
. (We can’t tell which one is relevant until
they are decrypted.)
Currently, these are held in Room rather than RoomInfo, because we were not sure whether holding too many of them might make the cache too slow to load on startup. Keeping them here means they are not cached to disk but held in memory.
Implementations§
source§impl 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 num_unread_messages(&self) -> u64
pub fn num_unread_messages(&self) -> u64
Get the number of unread messages (computed client-side).
This might be more precise than Self::unread_notification_counts
for
encrypted rooms.
sourcepub fn num_unread_notifications(&self) -> u64
pub fn num_unread_notifications(&self) -> u64
Get the number of unread notifications (computed client-side).
This might be more precise than Self::unread_notification_counts
for
encrypted rooms.
sourcepub fn num_unread_mentions(&self) -> u64
pub fn num_unread_mentions(&self) -> u64
Get the number of unread mentions (computed client-side), that is, messages causing a highlight in a room.
This might be more precise than Self::unread_notification_counts
for
encrypted rooms.
sourcepub fn are_members_synced(&self) -> bool
pub fn are_members_synced(&self) -> bool
Check if the room has its 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 mark_members_missing(&self)
pub fn mark_members_missing(&self)
Mark this Room as still missing member information.
sourcepub fn is_state_fully_synced(&self) -> bool
pub fn is_state_fully_synced(&self) -> bool
Check if the room states have been synced
States might be missing if we have only seen the room_id of this Room
so far, for example as the response for a create_room
request without
being synced yet.
Returns true if the state is fully synced, false otherwise.
sourcepub fn is_encryption_state_synced(&self) -> bool
pub fn is_encryption_state_synced(&self) -> bool
Check if the room has its encryption event synced.
The encryption event can be missing when the room hasn’t appeared in sync yet.
Returns true if the encryption state is synced, 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>
pub fn alt_aliases(&self) -> Vec<OwnedRoomAliasId>
Get the canonical alias of this room.
sourcepub fn create_content(&self) -> Option<RoomCreateWithCreatorEventContent>
pub fn create_content(&self) -> Option<RoomCreateWithCreatorEventContent>
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.
For room versions earlier than room version 11, if the event is
redacted, all fields except creator
will be set to their default
value.
sourcepub async fn is_direct(&self) -> StoreResult<bool>
pub async fn is_direct(&self) -> StoreResult<bool>
Is this room considered a direct message.
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. We leave members in this list to allow us to re-find a DM with a user even if they have left, since we may want to re-invite them.
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 name(&self) -> Option<String>
pub fn name(&self) -> Option<String>
Get the m.room.name
of this room.
The returned string is guaranteed not to be empty.
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 fn has_active_room_call(&self) -> bool
pub fn has_active_room_call(&self) -> bool
Is there a non expired membership with application “m.call” and scope “m.room” in this room
sourcepub fn active_room_call_participants(&self) -> Vec<OwnedUserId>
pub fn active_room_call_participants(&self) -> Vec<OwnedUserId>
Returns a Vec of userId’s that participate in the room call.
matrix_rtc memberships with application “m.call” and scope “m.room” are considered. A user can occur twice if they join with two devices. convert to a set depending if the different users are required or the amount of sessions.
The vector is ordered by oldest membership user to newest.
sourcepub async fn display_name(&self) -> StoreResult<DisplayName>
pub async fn display_name(&self) -> StoreResult<DisplayName>
Return the cached display name of the room if it was provided via sync, or otherwise calculate it, taking into account its name, aliases and members.
The display name is calculated according to this algorithm.
sourcepub fn latest_event(&self) -> Option<LatestEvent>
Available on crate feature experimental-sliding-sync
only.
pub fn latest_event(&self) -> Option<LatestEvent>
experimental-sliding-sync
only.Return the last event in this room, if one has been cached during sliding sync.
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,
memberships: RoomMemberships
) -> StoreResult<Vec<RoomMember>>
pub async fn members( &self, memberships: RoomMemberships ) -> StoreResult<Vec<RoomMember>>
Get the RoomMember
s of this room that are known to the store, with the
given memberships.
sourcepub async fn joined_members(&self) -> StoreResult<Vec<RoomMember>>
👎Deprecated: Use members with RoomMemberships::JOIN instead
pub async fn joined_members(&self) -> StoreResult<Vec<RoomMember>>
Get the list of RoomMember
s that are considered to be joined members
of this room.
sourcepub async fn active_members(&self) -> StoreResult<Vec<RoomMember>>
👎Deprecated: Use members with RoomMemberships::ACTIVE instead
pub async fn active_members(&self) -> StoreResult<Vec<RoomMember>>
Get the list of RoomMember
s that are considered to be joined or
invited members of this room.
sourcepub fn active_members_count(&self) -> u64
pub fn active_members_count(&self) -> u64
Returns the number of members who have joined or been invited to the room.
sourcepub fn invited_members_count(&self) -> u64
pub fn invited_members_count(&self) -> u64
Returns the number of members who have been invited to the room.
sourcepub fn joined_members_count(&self) -> u64
pub fn joined_members_count(&self) -> u64
Returns the number of members who have joined the room.
sourcepub fn subscribe_info(&self) -> Subscriber<RoomInfo>
pub fn subscribe_info(&self) -> Subscriber<RoomInfo>
Subscribe to the inner RoomInfo
.
sourcepub fn clone_info(&self) -> RoomInfo
pub fn clone_info(&self) -> RoomInfo
Clone the inner RoomInfo
.
sourcepub fn set_room_info(&self, room_info: RoomInfo)
pub fn set_room_info(&self, room_info: RoomInfo)
Update the inner summary with the given RoomInfo, and notify subscribers.
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 load_user_receipt(
&self,
receipt_type: ReceiptType,
thread: ReceiptThread,
user_id: &UserId
) -> StoreResult<Option<(OwnedEventId, Receipt)>>
pub async fn load_user_receipt( &self, receipt_type: ReceiptType, thread: ReceiptThread, user_id: &UserId ) -> StoreResult<Option<(OwnedEventId, Receipt)>>
Get the receipt as an OwnedEventId
and Receipt
tuple for the given
receipt_type
, thread
and user_id
in this room.
sourcepub async fn load_event_receipts(
&self,
receipt_type: ReceiptType,
thread: ReceiptThread,
event_id: &EventId
) -> StoreResult<Vec<(OwnedUserId, Receipt)>>
pub async fn load_event_receipts( &self, receipt_type: ReceiptType, thread: ReceiptThread, event_id: &EventId ) -> StoreResult<Vec<(OwnedUserId, Receipt)>>
Load from storage the receipts as a list of OwnedUserId
and Receipt
tuples for the given receipt_type
, thread
and event_id
in this
room.