summaryrefslogtreecommitdiff
path: root/includes/external/matrix/node_modules/matrix-js-sdk/lib/models/user.js.map
diff options
context:
space:
mode:
Diffstat (limited to 'includes/external/matrix/node_modules/matrix-js-sdk/lib/models/user.js.map')
-rw-r--r--includes/external/matrix/node_modules/matrix-js-sdk/lib/models/user.js.map1
1 files changed, 0 insertions, 1 deletions
diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/models/user.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/models/user.js.map
deleted file mode 100644
index fbc10e5..0000000
--- a/includes/external/matrix/node_modules/matrix-js-sdk/lib/models/user.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"user.js","names":["_typedEventEmitter","require","UserEvent","exports","User","TypedEventEmitter","constructor","userId","_defineProperty2","default","displayName","rawDisplayName","updateModifiedTime","setPresenceEvent","event","getType","firstFire","events","presence","eventsToFire","getContent","push","Presence","avatar_url","avatarUrl","AvatarUrl","displayname","DisplayName","currently_active","undefined","currentlyActive","CurrentlyActive","LastPresenceTs","status_msg","presenceStatusMsg","lastActiveAgo","last_active_ago","lastPresenceTs","Date","now","eventToFire","emit","setDisplayName","name","oldName","setRawDisplayName","setAvatarUrl","url","oldUrl","modified","getLastModifiedTime","getLastActiveTs"],"sources":["../../src/models/user.ts"],"sourcesContent":["/*\nCopyright 2015 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MatrixEvent } from \"./event\";\nimport { TypedEventEmitter } from \"./typed-event-emitter\";\n\nexport enum UserEvent {\n DisplayName = \"User.displayName\",\n AvatarUrl = \"User.avatarUrl\",\n Presence = \"User.presence\",\n CurrentlyActive = \"User.currentlyActive\",\n LastPresenceTs = \"User.lastPresenceTs\",\n}\n\nexport type UserEventHandlerMap = {\n /**\n * Fires whenever any user's display name changes.\n * @param event - The matrix event which caused this event to fire.\n * @param user - The user whose User.displayName changed.\n * @example\n * ```\n * matrixClient.on(\"User.displayName\", function(event, user){\n * var newName = user.displayName;\n * });\n * ```\n */\n [UserEvent.DisplayName]: (event: MatrixEvent | undefined, user: User) => void;\n /**\n * Fires whenever any user's avatar URL changes.\n * @param event - The matrix event which caused this event to fire.\n * @param user - The user whose User.avatarUrl changed.\n * @example\n * ```\n * matrixClient.on(\"User.avatarUrl\", function(event, user){\n * var newUrl = user.avatarUrl;\n * });\n * ```\n */\n [UserEvent.AvatarUrl]: (event: MatrixEvent | undefined, user: User) => void;\n /**\n * Fires whenever any user's presence changes.\n * @param event - The matrix event which caused this event to fire.\n * @param user - The user whose User.presence changed.\n * @example\n * ```\n * matrixClient.on(\"User.presence\", function(event, user){\n * var newPresence = user.presence;\n * });\n * ```\n */\n [UserEvent.Presence]: (event: MatrixEvent | undefined, user: User) => void;\n /**\n * Fires whenever any user's currentlyActive changes.\n * @param event - The matrix event which caused this event to fire.\n * @param user - The user whose User.currentlyActive changed.\n * @example\n * ```\n * matrixClient.on(\"User.currentlyActive\", function(event, user){\n * var newCurrentlyActive = user.currentlyActive;\n * });\n * ```\n */\n [UserEvent.CurrentlyActive]: (event: MatrixEvent | undefined, user: User) => void;\n /**\n * Fires whenever any user's lastPresenceTs changes,\n * ie. whenever any presence event is received for a user.\n * @param event - The matrix event which caused this event to fire.\n * @param user - The user whose User.lastPresenceTs changed.\n * @example\n * ```\n * matrixClient.on(\"User.lastPresenceTs\", function(event, user){\n * var newlastPresenceTs = user.lastPresenceTs;\n * });\n * ```\n */\n [UserEvent.LastPresenceTs]: (event: MatrixEvent | undefined, user: User) => void;\n};\n\nexport class User extends TypedEventEmitter<UserEvent, UserEventHandlerMap> {\n private modified = -1;\n\n /**\n * The 'displayname' of the user if known.\n * @privateRemarks\n * Should be read-only\n */\n public displayName?: string;\n public rawDisplayName?: string;\n /**\n * The 'avatar_url' of the user if known.\n * @privateRemarks\n * Should be read-only\n */\n public avatarUrl?: string;\n /**\n * The presence status message if known.\n * @privateRemarks\n * Should be read-only\n */\n public presenceStatusMsg?: string;\n /**\n * The presence enum if known.\n * @privateRemarks\n * Should be read-only\n */\n public presence = \"offline\";\n /**\n * Timestamp (ms since the epoch) for when we last received presence data for this user.\n * We can subtract lastActiveAgo from this to approximate an absolute value for when a user was last active.\n * @privateRemarks\n * Should be read-only\n */\n public lastActiveAgo = 0;\n /**\n * The time elapsed in ms since the user interacted proactively with the server,\n * or we saw a message from the user\n * @privateRemarks\n * Should be read-only\n */\n public lastPresenceTs = 0;\n /**\n * Whether we should consider lastActiveAgo to be an approximation\n * and that the user should be seen as active 'now'\n * @privateRemarks\n * Should be read-only\n */\n public currentlyActive = false;\n /**\n * The events describing this user.\n * @privateRemarks\n * Should be read-only\n */\n public events: {\n /** The m.presence event for this user. */\n presence?: MatrixEvent;\n profile?: MatrixEvent;\n } = {};\n\n /**\n * Construct a new User. A User must have an ID and can optionally have extra information associated with it.\n * @param userId - Required. The ID of this user.\n */\n public constructor(public readonly userId: string) {\n super();\n this.displayName = userId;\n this.rawDisplayName = userId;\n this.updateModifiedTime();\n }\n\n /**\n * Update this User with the given presence event. May fire \"User.presence\",\n * \"User.avatarUrl\" and/or \"User.displayName\" if this event updates this user's\n * properties.\n * @param event - The `m.presence` event.\n *\n * @remarks\n * Fires {@link UserEvent.Presence}\n * Fires {@link UserEvent.DisplayName}\n * Fires {@link UserEvent.AvatarUrl}\n */\n public setPresenceEvent(event: MatrixEvent): void {\n if (event.getType() !== \"m.presence\") {\n return;\n }\n const firstFire = this.events.presence === null;\n this.events.presence = event;\n\n const eventsToFire: UserEvent[] = [];\n if (event.getContent().presence !== this.presence || firstFire) {\n eventsToFire.push(UserEvent.Presence);\n }\n if (event.getContent().avatar_url && event.getContent().avatar_url !== this.avatarUrl) {\n eventsToFire.push(UserEvent.AvatarUrl);\n }\n if (event.getContent().displayname && event.getContent().displayname !== this.displayName) {\n eventsToFire.push(UserEvent.DisplayName);\n }\n if (\n event.getContent().currently_active !== undefined &&\n event.getContent().currently_active !== this.currentlyActive\n ) {\n eventsToFire.push(UserEvent.CurrentlyActive);\n }\n\n this.presence = event.getContent().presence;\n eventsToFire.push(UserEvent.LastPresenceTs);\n\n if (event.getContent().status_msg) {\n this.presenceStatusMsg = event.getContent().status_msg;\n }\n if (event.getContent().displayname) {\n this.displayName = event.getContent().displayname;\n }\n if (event.getContent().avatar_url) {\n this.avatarUrl = event.getContent().avatar_url;\n }\n this.lastActiveAgo = event.getContent().last_active_ago;\n this.lastPresenceTs = Date.now();\n this.currentlyActive = event.getContent().currently_active;\n\n this.updateModifiedTime();\n\n for (const eventToFire of eventsToFire) {\n this.emit(eventToFire, event, this);\n }\n }\n\n /**\n * Manually set this user's display name. No event is emitted in response to this\n * as there is no underlying MatrixEvent to emit with.\n * @param name - The new display name.\n */\n public setDisplayName(name: string): void {\n const oldName = this.displayName;\n this.displayName = name;\n if (name !== oldName) {\n this.updateModifiedTime();\n }\n }\n\n /**\n * Manually set this user's non-disambiguated display name. No event is emitted\n * in response to this as there is no underlying MatrixEvent to emit with.\n * @param name - The new display name.\n */\n public setRawDisplayName(name?: string): void {\n this.rawDisplayName = name;\n }\n\n /**\n * Manually set this user's avatar URL. No event is emitted in response to this\n * as there is no underlying MatrixEvent to emit with.\n * @param url - The new avatar URL.\n */\n public setAvatarUrl(url?: string): void {\n const oldUrl = this.avatarUrl;\n this.avatarUrl = url;\n if (url !== oldUrl) {\n this.updateModifiedTime();\n }\n }\n\n /**\n * Update the last modified time to the current time.\n */\n private updateModifiedTime(): void {\n this.modified = Date.now();\n }\n\n /**\n * Get the timestamp when this User was last updated. This timestamp is\n * updated when this User receives a new Presence event which has updated a\n * property on this object. It is updated <i>before</i> firing events.\n * @returns The timestamp\n */\n public getLastModifiedTime(): number {\n return this.modified;\n }\n\n /**\n * Get the absolute timestamp when this User was last known active on the server.\n * It is *NOT* accurate if this.currentlyActive is true.\n * @returns The timestamp\n */\n public getLastActiveTs(): number {\n return this.lastPresenceTs - this.lastActiveAgo;\n }\n}\n"],"mappings":";;;;;;;;AAiBA,IAAAA,kBAAA,GAAAC,OAAA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAmBYC,SAAS;AAAAC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,WAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;AAAA,GAATA,SAAS,KAAAC,OAAA,CAAAD,SAAA,GAATA,SAAS;AAwEd,MAAME,IAAI,SAASC,oCAAiB,CAAiC;EAGxE;AACJ;AACA;AACA;AACA;;EAGI;AACJ;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;;EAOI;AACJ;AACA;AACA;EACWC,WAAWA,CAAiBC,MAAc,EAAE;IAC/C,KAAK,EAAE;IAAC,KADuBA,MAAc,GAAdA,MAAc;IAAA,IAAAC,gBAAA,CAAAC,OAAA,oBA/D9B,CAAC,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBA0BH,SAAS;IAAA,IAAAD,gBAAA,CAAAC,OAAA,yBAOJ,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,0BAOA,CAAC;IAAA,IAAAD,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