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

  • Construct a new room member.

    Alias

    module:models/room-member

    Prop

    The room ID for this member.

    Prop

    The user ID of this member.

    Prop

    True if the room member is currently typing.

    Prop

    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.

    Prop

    The ambiguous displayname of this room member.

    Prop

    The power level for this room member.

    Prop

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

    Prop

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

    Prop

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

    Prop

    The events describing this RoomMember.

    Prop

    The m.room.member event for this RoomMember.

    Prop

    True if the member's name is disambiguated.

    Parameters

    • roomId: string

      The room ID of the member.

    • userId: string

      The user ID of the member.

    Returns RoomMember

Properties

_isOutOfBand: boolean = false
disambiguate: boolean = false
events: {
    member?: MatrixEvent;
} = {}

Type declaration

membership?: string
modified: number = -1
name: string
powerLevel: number = 0
powerLevelNorm: number = 0
rawDisplayName: string
requestedProfileInfo: boolean = false
roomId: string

The room ID of the member.

typing: boolean = false
user?: User
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 module:client~MatrixClient#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.

    Fires

    module:client~MatrixClient#event:"RoomMember.name"

    Fires

    module:client~MatrixClient#event:"RoomMember.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.

    Fires

    module:client~MatrixClient#event:"RoomMember.powerLevel"

    Parameters

    • powerLevelEvent: MatrixEvent

      The m.room.power_levels event

    Returns void

  • Update this room member's typing event. May fire "RoomMember.typing" if this event changes this member's typing state.

    Fires

    module:client~MatrixClient#event:"RoomMember.typing"

    Parameters

    Returns void

Generated using TypeDoc