Class RoomMember

Typed Event Emitter class which can act as a Base Model for all our model and communication events. This makes it much easier for us to distinguish between events, as we now need to properly type this, so that our events are not stringly-based and prone to silly typos.

Hierarchy

Constructors

Properties

_isOutOfBand: boolean = false
disambiguate: boolean = false

True if the member's name is disambiguated.

events: {
    member?: MatrixEvent;
} = {}

The events describing this RoomMember.

Type declaration

  • Optional member?: MatrixEvent

    The m.room.member event for this RoomMember.

membership?: string

The membership state for this room member e.g. 'join'.

modified: number = -1
name: string

The human-readable name for this room member. This will be disambiguated with a suffix of " (@user_id:matrix.org)" if another member shares the same displayname.

powerLevel: number = 0

The power level for this room member.

powerLevelNorm: number = 0

The normalised power level (0-100) for this room member.

rawDisplayName: string

The ambiguous displayname of this room member.

requestedProfileInfo: boolean = false
roomId: string

The room ID of the member.

typing: boolean = false

True if the room member is currently typing.

user?: User

The User object for this room member, if one exists.

userId: string

The user ID of the member.

Methods

  • Get the avatar URL for a room member.

    Returns

    the avatar URL or null.

    Parameters

    • baseUrl: string

      The base homeserver URL See getHomeserverUrl.

    • width: number

      The desired width of the thumbnail.

    • height: number

      The desired height of the thumbnail.

    • resizeMethod: string

      The thumbnail resize method to use, either "crop" or "scale".

    • allowDefault: boolean = true

      (optional) Passing false causes this method to return null if the user has no avatar image. Otherwise, a default image URL will be returned. Default: true. (Deprecated)

    • allowDirectLinks: boolean

      (optional) If true, the avatar URL will be returned even if it is a direct hyperlink rather than a matrix content URL. If false, any non-matrix content URLs will be ignored. Setting this option to true will expose URLs that, if fetched, will leak information about the user to anyone who they share a room with.

    Returns null | string

  • If this member was invited with the is_direct flag set, return the user that invited this member

    Returns

    user id of the inviter

    Returns undefined | string

  • Get the timestamp when this RoomMember was last updated. This timestamp is updated when properties on this RoomMember are updated. It is updated before firing events.

    Returns

    The timestamp

    Returns number

  • get the mxc avatar url, either from a state event, or from a lazily loaded member

    Returns

    the mxc avatar url

    Returns undefined | string

  • Returns

    does the member come from a channel that is not sync? This is used to store the member seperately from the sync state so it available across browser sessions.

    Returns boolean

  • Update this room member's membership event. May fire "RoomMember.name" if this event updates this member's name.

    Remarks

    Fires Name Fires Membership

    Parameters

    • event: MatrixEvent

      The m.room.member event

    • Optional roomState: RoomState

      Optional. The room state to take into account when calculating (e.g. for disambiguating users with the same name).

    Returns void

  • Update this room member's power level event. May fire "RoomMember.powerLevel" if this event updates this member's power levels.

    Remarks

    Fires PowerLevel

    Parameters

    • powerLevelEvent: MatrixEvent

      The m.room.power_levels event

    Returns void

Generated using TypeDoc