1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
import { User } from "./user";
import { MatrixEvent } from "./event";
import { RoomState } from "./room-state";
import { TypedEventEmitter } from "./typed-event-emitter";
export declare enum RoomMemberEvent {
Membership = "RoomMember.membership",
Name = "RoomMember.name",
PowerLevel = "RoomMember.powerLevel",
Typing = "RoomMember.typing"
}
export type RoomMemberEventHandlerMap = {
/**
* Fires whenever any room member's membership state changes.
* @param event - The matrix event which caused this event to fire.
* @param member - The member whose RoomMember.membership changed.
* @param oldMembership - The previous membership state. Null if it's a new member.
* @example
* ```
* matrixClient.on("RoomMember.membership", function(event, member, oldMembership){
* var newState = member.membership;
* });
* ```
*/
[RoomMemberEvent.Membership]: (event: MatrixEvent, member: RoomMember, oldMembership?: string) => void;
/**
* Fires whenever any room member's name changes.
* @param event - The matrix event which caused this event to fire.
* @param member - The member whose RoomMember.name changed.
* @param oldName - The previous name. Null if the member didn't have a name previously.
* @example
* ```
* matrixClient.on("RoomMember.name", function(event, member){
* var newName = member.name;
* });
* ```
*/
[RoomMemberEvent.Name]: (event: MatrixEvent, member: RoomMember, oldName: string | null) => void;
/**
* Fires whenever any room member's power level changes.
* @param event - The matrix event which caused this event to fire.
* @param member - The member whose RoomMember.powerLevel changed.
* @example
* ```
* matrixClient.on("RoomMember.powerLevel", function(event, member){
* var newPowerLevel = member.powerLevel;
* var newNormPowerLevel = member.powerLevelNorm;
* });
* ```
*/
[RoomMemberEvent.PowerLevel]: (event: MatrixEvent, member: RoomMember) => void;
/**
* Fires whenever any room member's typing state changes.
* @param event - The matrix event which caused this event to fire.
* @param member - The member whose RoomMember.typing changed.
* @example
* ```
* matrixClient.on("RoomMember.typing", function(event, member){
* var isTyping = member.typing;
* });
* ```
*/
[RoomMemberEvent.Typing]: (event: MatrixEvent, member: RoomMember) => void;
};
export declare class RoomMember extends TypedEventEmitter<RoomMemberEvent, RoomMemberEventHandlerMap> {
readonly roomId: string;
readonly userId: string;
private _isOutOfBand;
private modified;
requestedProfileInfo: boolean;
/**
* True if the room member is currently typing.
*/
typing: boolean;
/**
* 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.
*/
name: string;
/**
* The ambiguous displayname of this room member.
*/
rawDisplayName: string;
/**
* The power level for this room member.
*/
powerLevel: number;
/**
* The normalised power level (0-100) for this room member.
*/
powerLevelNorm: number;
/**
* The User object for this room member, if one exists.
*/
user?: User;
/**
* The membership state for this room member e.g. 'join'.
*/
membership?: string;
/**
* True if the member's name is disambiguated.
*/
disambiguate: boolean;
/**
* The events describing this RoomMember.
*/
events: {
/**
* The m.room.member event for this RoomMember.
*/
member?: MatrixEvent;
};
/**
* Construct a new room member.
*
* @param roomId - The room ID of the member.
* @param userId - The user ID of the member.
*/
constructor(roomId: string, userId: string);
/**
* Mark the member as coming from a channel that is not sync
*/
markOutOfBand(): void;
/**
* @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.
*/
isOutOfBand(): boolean;
/**
* Update this room member's membership event. May fire "RoomMember.name" if
* this event updates this member's name.
* @param event - The `m.room.member` event
* @param roomState - Optional. The room state to take into account
* when calculating (e.g. for disambiguating users with the same name).
*
* @remarks
* Fires {@link RoomMemberEvent.Name}
* Fires {@link RoomMemberEvent.Membership}
*/
setMembershipEvent(event: MatrixEvent, roomState?: RoomState): void;
/**
* Update this room member's power level event. May fire
* "RoomMember.powerLevel" if this event updates this member's power levels.
* @param powerLevelEvent - The `m.room.power_levels` event
*
* @remarks
* Fires {@link RoomMemberEvent.PowerLevel}
*/
setPowerLevelEvent(powerLevelEvent: MatrixEvent): void;
/**
* Update this room member's typing event. May fire "RoomMember.typing" if
* this event changes this member's typing state.
* @param event - The typing event
*
* @remarks
* Fires {@link RoomMemberEvent.Typing}
*/
setTypingEvent(event: MatrixEvent): void;
/**
* Update the last modified time to the current time.
*/
private updateModifiedTime;
/**
* Get the timestamp when this RoomMember was last updated. This timestamp is
* updated when properties on this RoomMember are updated.
* It is updated <i>before</i> firing events.
* @returns The timestamp
*/
getLastModifiedTime(): number;
isKicked(): boolean;
/**
* If this member was invited with the is_direct flag set, return
* the user that invited this member
* @returns user id of the inviter
*/
getDMInviter(): string | undefined;
/**
* Get the avatar URL for a room member.
* @param baseUrl - The base homeserver URL See
* {@link MatrixClient#getHomeserverUrl}.
* @param width - The desired width of the thumbnail.
* @param height - The desired height of the thumbnail.
* @param resizeMethod - The thumbnail resize method to use, either
* "crop" or "scale".
* @param allowDefault - (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)
* @param allowDirectLinks - (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 the avatar URL or null.
*/
getAvatarUrl(baseUrl: string, width: number, height: number, resizeMethod: string, allowDefault: boolean | undefined, allowDirectLinks: boolean): string | null;
/**
* get the mxc avatar url, either from a state event, or from a lazily loaded member
* @returns the mxc avatar url
*/
getMxcAvatarUrl(): string | undefined;
}
//# sourceMappingURL=room-member.d.ts.map
|