Class: module:models/room-member

module:models/room-member

new module:models/room-member(roomId, userId)

Construct a new room member.
Parameters:
Name Type Description
roomId string The room ID of the member.
userId string The user ID of the member.
Properties:
Name Type Description
roomId string The room ID for this member.
userId string The user ID of this member.
typing boolean True if the room member is currently typing.
name string The human-readable name for this room member.
powerLevel Number The power level for this room member.
powerLevelNorm Number The normalised power level (0-100) for this room member.
user User The User object for this room member, if one exists.
membership string The membership state for this room member e.g. 'join'.
events Object The events describing this RoomMember.
Properties
Name Type Description
member MatrixEvent The m.room.member event for this RoomMember.
Source:

Methods

_updateModifiedTime()

Update the last modified time to the current time.
Source:

getAvatarUrl(baseUrl, width, height, resizeMethod, allowDefault, allowDirectLinks) → (nullable) {string}

Get the avatar URL for a room member.
Parameters:
Name Type Description
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 (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.
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.
Source:
Returns:
the avatar URL or null.
Type
string

getLastModifiedTime() → {number}

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.
Source:
Returns:
The timestamp
Type
number

setMembershipEvent(event, roomState)

Update this room member's membership event. May fire "RoomMember.name" if this event updates this member's name.
Parameters:
Name Type Description
event MatrixEvent The m.room.member event
roomState RoomState Optional. The room state to take into account when calculating (e.g. for disambiguating users with the same name).
Source:
Fires:
  • module:client~MatrixClient#event:"RoomMember.name"
  • module:client~MatrixClient#event:"RoomMember.membership"

setPowerLevelEvent(powerLevelEvent)

Update this room member's power level event. May fire "RoomMember.powerLevel" if this event updates this member's power levels.
Parameters:
Name Type Description
powerLevelEvent MatrixEvent The m.room.power_levels event
Source:
Fires:
  • module:client~MatrixClient#event:"RoomMember.powerLevel"

setTypingEvent(event)

Update this room member's typing event. May fire "RoomMember.typing" if this event changes this member's typing state.
Parameters:
Name Type Description
event MatrixEvent The typing event
Source:
Fires:
  • module:client~MatrixClient#event:"RoomMember.typing"