[][src]Struct matrix_sdk::Room

pub struct Room {
    pub room_id: RoomId,
    pub room_name: RoomName,
    pub own_user_id: UserId,
    pub creator: Option<UserId>,
    pub direct_target: Option<UserId>,
    pub invited_members: HashMap<UserId, RoomMember, RandomState>,
    pub joined_members: HashMap<UserId, RoomMember, RandomState>,
    pub messages: MessageQueue,
    pub typing_users: Vec<UserId, Global>,
    pub power_levels: Option<PowerLevels>,
    pub encrypted: Option<EncryptionInfo>,
    pub unread_highlight: Option<UInt>,
    pub unread_notifications: Option<UInt>,
    pub tombstone: Option<Tombstone>,
}

A Matrix room.

Fields

room_id: RoomId

The unique id of the room.

room_name: RoomName

The name of the room, clients use this to represent a room.

own_user_id: UserId

The mxid of our own user.

creator: Option<UserId>

The mxid of the room creator.

direct_target: Option<UserId>

The mxid of the "direct" target if any

invited_members: HashMap<UserId, RoomMember, RandomState>

The map of invited room members.

joined_members: HashMap<UserId, RoomMember, RandomState>

The map of joined room members.

messages: MessageQueue

A queue of messages, holds no more than 10 of the most recent messages.

This is helpful when using a StateStore to avoid multiple requests to the server for messages.

typing_users: Vec<UserId, Global>

A list of users that are currently typing.

power_levels: Option<PowerLevels>

The power level requirements for specific actions in this room

encrypted: Option<EncryptionInfo>

Optional encryption info, will be Some if the room is encrypted.

unread_highlight: Option<UInt>

Number of unread notifications with highlight flag set.

unread_notifications: Option<UInt>

Number of unread notifications.

tombstone: Option<Tombstone>

The tombstone state of this room.

Implementations

impl Room[src]

pub fn new(room_id: &RoomId, own_user_id: &UserId) -> Room[src]

Create a new room.

Arguments

  • room_id - The unique id of the room.

  • own_user_id - The mxid of our own user.

pub fn display_name(&self) -> String[src]

Return the display name of the room.

pub fn is_encrypted(&self) -> bool[src]

Is the room a encrypted room.

pub fn encryption_info(&self) -> Option<&EncryptionInfo>[src]

Get the encryption info if any of the room.

Returns None if the room is not encrypted.

pub fn member_is_tracked(&self, user_id: &UserId) -> bool[src]

Check whether the user with the MXID user_id is joined or invited to the room.

Returns true if so, false otherwise.

pub fn get_member(&self, user_id: &UserId) -> Option<&RoomMember>[src]

Get a room member by user ID.

If there is no such member, returns None.

pub fn get_member_mut(&mut self, user_id: &UserId) -> Option<&mut RoomMember>[src]

Get a room member by user ID.

If there is no such member, returns None.

pub fn handle_membership(
    &mut self,
    event: &SyncStateEvent<MemberEventContent>,
    state_event: bool
) -> (bool, HashMap<UserId, bool, RandomState>)
[src]

Handle a room.member updating the room state if necessary.

Returns a tuple of:

  1. True if the joined member list changed, false otherwise.
  2. A map of display name ambiguity status changes (see disambiguation_updates).

pub fn handle_message(&mut self, event: &AnySyncMessageEvent) -> bool[src]

Handle a room.message event and update the MessageQueue if necessary.

Returns true if MessageQueue was added to.

pub fn handle_redaction(&mut self, redacted_event: &SyncRedactionEvent) -> bool[src]

Handle a room.redaction event and update the MessageQueue.

Returns true if MessageQueue was updated. The effected message event has it's contents replaced with the RedactionEventContents and the whole redaction event is added to the Unsigned redacted_because field.

pub fn handle_room_aliases(
    &mut self,
    event: &SyncStateEvent<AliasesEventContent>
) -> bool
[src]

Handle a room.aliases event, updating the room state if necessary.

Returns true if the room name changed, false otherwise.

pub fn handle_canonical(
    &mut self,
    event: &SyncStateEvent<CanonicalAliasEventContent>
) -> bool
[src]

Handle a room.canonical_alias event, updating the room state if necessary.

Returns true if the room name changed, false otherwise.

pub fn handle_room_name(
    &mut self,
    event: &SyncStateEvent<NameEventContent>
) -> bool
[src]

Handle a room.name event, updating the room state if necessary.

Returns true if the room name changed, false otherwise.

pub fn handle_stripped_room_name(
    &mut self,
    event: &StrippedStateEvent<NameEventContent>
) -> bool
[src]

Handle a room.name event, updating the room state if necessary.

Returns true if the room name changed, false otherwise.

pub fn handle_power_level(
    &mut self,
    event: &SyncStateEvent<PowerLevelsEventContent>
) -> bool
[src]

Handle a room.power_levels event, updating the room state if necessary.

Returns true if the room name changed, false otherwise.

pub fn handle_direct(&mut self, user_id: &UserId) -> bool[src]

Handle setting direct attribute as part of a m.direct event, updating the room if necessary

Returns true if the direct_target changed, false otherwise.

pub fn receive_timeline_event(&mut self, event: &AnySyncRoomEvent) -> bool[src]

Receive a timeline event for this room and update the room state.

Returns true if the joined member list changed, false otherwise.

Arguments

  • event - The event of the room.

pub fn receive_state_event(&mut self, event: &AnySyncStateEvent) -> bool[src]

Receive a state event for this room and update the room state.

Returns true if the state of the Room has changed, false otherwise.

Arguments

  • event - The event of the room.

pub fn receive_stripped_state_event(
    &mut self,
    event: &AnyStrippedStateEvent
) -> bool
[src]

Receive a stripped state event for this room and update the room state.

Returns true if the state of the Room has changed, false otherwise.

Arguments

  • event - The AnyStrippedStateEvent sent by the server for invited but not joined rooms.

pub fn receive_presence_event(&mut self, event: &PresenceEvent) -> bool[src]

Receive a presence event for a member of the current room.

Returns true if the event causes a change to the member's presence, false otherwise.

Arguments

  • event - The presence event to receive and process.

pub fn update_member_profile(
    &mut self,
    target_member: &UserId,
    event: &SyncStateEvent<MemberEventContent>,
    change: MembershipChange
) -> (bool, HashMap<UserId, bool, RandomState>)
[src]

Process an update of a member's profile.

Returns a tuple of:

  1. True if the event made changes to the room's state, false otherwise.
  2. A map of display name ambiguity status changes (see disambiguation_updates).

Arguments

  • target_member - The ID of the member to update.
  • event - The profile update event for the specified room member.

pub fn update_member_power(
    member: &mut RoomMember,
    event: &SyncStateEvent<PowerLevelsEventContent>,
    max_power: Int
) -> bool
[src]

Process an update of a member's power level.

Arguments

  • event - The power level event to process.
  • max_power - Maximum power level allowed.

Trait Implementations

impl Clone for Room[src]

impl Debug for Room[src]

impl<'de> Deserialize<'de> for Room[src]

impl PartialEq<Room> for Room[src]

impl Serialize for Room[src]

impl StructuralPartialEq for Room[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsyncTraitDeps for T where
    T: Send + Sync + Debug
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]