|
@@ -1,3 +1,8 @@
|
|
|
+/**
|
|
|
+ * @typedef {import('../muc/message.js').default} MUCMessage
|
|
|
+ * @typedef {module:plugin-chat-parsers.MessageAttributes} MessageAttributes
|
|
|
+ * @typedef {import('strophe.js/src/builder.js').Builder} Strophe.Builder
|
|
|
+ */
|
|
|
import _converse from '../../shared/_converse.js';
|
|
|
import api, { converse } from '../../shared/api/index.js';
|
|
|
import ChatBox from '../chat/model';
|
|
@@ -51,7 +56,7 @@ const METADATA_ATTRIBUTES = [
|
|
|
const ACTION_INFO_CODES = ['301', '303', '333', '307', '321', '322'];
|
|
|
|
|
|
class MUCSession extends Model {
|
|
|
- defaults () { // eslint-disable-line class-methods-use-this
|
|
|
+ defaults () {
|
|
|
return {
|
|
|
'connection_status': ROOMSTATUS.DISCONNECTED
|
|
|
};
|
|
@@ -60,12 +65,12 @@ class MUCSession extends Model {
|
|
|
|
|
|
/**
|
|
|
* Represents an open/ongoing groupchat conversation.
|
|
|
- * @namespace _converse.ChatRoom
|
|
|
+ * @namespace MUC
|
|
|
* @memberOf _converse
|
|
|
*/
|
|
|
class MUC extends ChatBox {
|
|
|
|
|
|
- defaults () { // eslint-disable-line class-methods-use-this
|
|
|
+ defaults () {
|
|
|
return {
|
|
|
'bookmarked': false,
|
|
|
'chat_state': undefined,
|
|
@@ -122,9 +127,9 @@ class MUC extends ChatBox {
|
|
|
this.join();
|
|
|
}
|
|
|
/**
|
|
|
- * Triggered once a {@link _converse.ChatRoom} has been created and initialized.
|
|
|
+ * Triggered once a {@link MUC} has been created and initialized.
|
|
|
* @event _converse#chatRoomInitialized
|
|
|
- * @type { _converse.ChatRoom }
|
|
|
+ * @type { MUC }
|
|
|
* @example _converse.api.listen.on('chatRoomInitialized', model => { ... });
|
|
|
*/
|
|
|
await api.trigger('chatRoomInitialized', this, { 'Synchronous': true });
|
|
@@ -137,7 +142,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)
|
|
|
- * @method _converse.ChatRoom#isRAICandidate
|
|
|
+ * @method MUC#isRAICandidate
|
|
|
* @returns { Boolean }
|
|
|
*/
|
|
|
isRAICandidate () {
|
|
@@ -147,7 +152,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Checks whether we're still joined and if so, restores the MUC state from cache.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#restoreFromCache
|
|
|
+ * @method MUC#restoreFromCache
|
|
|
* @returns { Boolean } Returns `true` if we're still joined, otherwise returns `false`.
|
|
|
*/
|
|
|
async restoreFromCache () {
|
|
@@ -173,8 +178,8 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Join the MUC
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#join
|
|
|
- * @param { String } nick - The user's nickname
|
|
|
+ * @method MUC#join
|
|
|
+ * @param { String } [nick] - The user's nickname
|
|
|
* @param { String } [password] - Optional password, if required by the groupchat.
|
|
|
* Will fall back to the `password` value stored in the room
|
|
|
* model (if available).
|
|
@@ -203,7 +208,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Clear stale cache and re-join a MUC we've been in before.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#rejoin
|
|
|
+ * @method MUC#rejoin
|
|
|
*/
|
|
|
rejoin () {
|
|
|
this.session.save('connection_status', ROOMSTATUS.DISCONNECTED);
|
|
@@ -230,7 +235,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* *Hook* which allows plugins to update an outgoing MUC join presence stanza
|
|
|
* @event _converse#constructedMUCPresence
|
|
|
- * @param { _converse.ChatRoom } - The MUC from which this message stanza is being sent.
|
|
|
+ * @param { MUC } - The MUC from which this message stanza is being sent.
|
|
|
* @param { Element } stanza - The stanza which will be sent out
|
|
|
*/
|
|
|
stanza = await api.hook('constructedMUCPresence', this, stanza);
|
|
@@ -249,7 +254,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Given the passed in MUC message, send a XEP-0333 chat marker.
|
|
|
- * @param { _converse.MUCMessage } msg
|
|
|
+ * @param { MUCMessage } msg
|
|
|
* @param { ('received'|'displayed'|'acknowledged') } [type='displayed']
|
|
|
* @param { Boolean } force - Whether a marker should be sent for the
|
|
|
* message, even if it didn't include a `markable` element.
|
|
@@ -278,7 +283,7 @@ class MUC extends ChatBox {
|
|
|
* called after the MUC has been left and we don't have that information
|
|
|
* anymore.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#enableRAI
|
|
|
+ * @method MUC#enableRAI
|
|
|
*/
|
|
|
enableRAI () {
|
|
|
if (api.settings.get('muc_subscribe_to_rai')) {
|
|
@@ -290,7 +295,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Handler that gets called when the 'hidden' flag is toggled.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#onHiddenChange
|
|
|
+ * @method MUC#onHiddenChange
|
|
|
*/
|
|
|
async onHiddenChange () {
|
|
|
const roomstatus = ROOMSTATUS;
|
|
@@ -511,7 +516,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Handles incoming message stanzas from the service that hosts this MUC
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#handleMessageFromMUCHost
|
|
|
+ * @method MUC#handleMessageFromMUCHost
|
|
|
* @param { Element } stanza
|
|
|
*/
|
|
|
handleMessageFromMUCHost (stanza) {
|
|
@@ -532,7 +537,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Handles XEP-0452 MUC Mention Notification messages
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#handleForwardedMentions
|
|
|
+ * @method MUC#handleForwardedMentions
|
|
|
* @param { Element } stanza
|
|
|
*/
|
|
|
handleForwardedMentions (stanza) {
|
|
@@ -562,7 +567,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Parses an incoming message stanza and queues it for processing.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#handleMessageStanza
|
|
|
+ * @method MUC#handleMessageStanza
|
|
|
* @param { Element } stanza
|
|
|
*/
|
|
|
async handleMessageStanza (stanza) {
|
|
@@ -611,7 +616,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Register presence and message handlers relevant to this groupchat
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#registerHandlers
|
|
|
+ * @method MUC#registerHandlers
|
|
|
*/
|
|
|
registerHandlers () {
|
|
|
const muc_jid = this.get('jid');
|
|
@@ -715,7 +720,7 @@ class MUC extends ChatBox {
|
|
|
* Sends a message stanza to the XMPP server and expects a reflection
|
|
|
* or error message within a specific timeout period.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#sendTimedMessage
|
|
|
+ * @method MUC#sendTimedMessage
|
|
|
* @param { _converse.Message|Element } message
|
|
|
* @returns { Promise<Element>|Promise<TimeoutError> } Returns a promise
|
|
|
* which resolves with the reflected message stanza or with an error stanza or {@link TimeoutError}.
|
|
@@ -751,7 +756,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Retract one of your messages in this groupchat
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#retractOwnMessage
|
|
|
+ * @method MUC#retractOwnMessage
|
|
|
* @param { _converse.Message } message - The message which we're retracting.
|
|
|
*/
|
|
|
async retractOwnMessage (message) {
|
|
@@ -801,7 +806,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Retract someone else's message in this groupchat.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#retractOtherMessage
|
|
|
+ * @method MUC#retractOtherMessage
|
|
|
* @param { _converse.ChatRoomMessage } message - The message which we're retracting.
|
|
|
* @param { string } [reason] - The reason for retracting the message.
|
|
|
* @example
|
|
@@ -836,7 +841,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Sends an IQ stanza to the XMPP server to retract a message in this groupchat.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#sendRetractionIQ
|
|
|
+ * @method MUC#sendRetractionIQ
|
|
|
* @param { _converse.ChatRoomMessage } message - The message which we're retracting.
|
|
|
* @param { string } [reason] - The reason for retracting the message.
|
|
|
*/
|
|
@@ -856,10 +861,10 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Sends an IQ stanza to the XMPP server to destroy this groupchat. Not
|
|
|
- * to be confused with the {@link _converse.ChatRoom#destroy}
|
|
|
+ * to be confused with the {@link MUC#destroy}
|
|
|
* method, which simply removes the room from the local browser storage cache.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#sendDestroyIQ
|
|
|
+ * @method MUC#sendDestroyIQ
|
|
|
* @param { string } [reason] - The reason for destroying the groupchat.
|
|
|
* @param { string } [new_jid] - The JID of the new groupchat which replaces this one.
|
|
|
*/
|
|
@@ -883,7 +888,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Leave the groupchat.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#leave
|
|
|
+ * @method MUC#leave
|
|
|
* @param { string } [exit_msg] - Message to indicate your reason for leaving
|
|
|
*/
|
|
|
async leave (exit_msg) {
|
|
@@ -941,7 +946,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Return an array of unique nicknames based on all occupants and messages in this MUC.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getAllKnownNicknames
|
|
|
+ * @method MUC#getAllKnownNicknames
|
|
|
* @returns { String[] }
|
|
|
*/
|
|
|
getAllKnownNicknames () {
|
|
@@ -1044,7 +1049,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Utility method to construct the JID for the current user as occupant of the groupchat.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getRoomJIDAndNick
|
|
|
+ * @method MUC#getRoomJIDAndNick
|
|
|
* @returns {string} - The groupchat JID with the user's nickname added at the end.
|
|
|
* @example groupchat@conference.example.org/nickname
|
|
|
*/
|
|
@@ -1056,9 +1061,9 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Sends a message with the current XEP-0085 chat state of the user
|
|
|
- * as taken from the `chat_state` attribute of the {@link _converse.ChatRoom}.
|
|
|
+ * as taken from the `chat_state` attribute of the {@link MUC}.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#sendChatState
|
|
|
+ * @method MUC#sendChatState
|
|
|
*/
|
|
|
sendChatState () {
|
|
|
if (
|
|
@@ -1091,7 +1096,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Send a direct invitation as per XEP-0249
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#directInvite
|
|
|
+ * @method MUC#directInvite
|
|
|
* @param { String } recipient - JID of the person being invited
|
|
|
* @param { String } [reason] - Reason for the invitation
|
|
|
*/
|
|
@@ -1123,7 +1128,7 @@ class MUC extends ChatBox {
|
|
|
* to a roster contact, asking them to join a room.
|
|
|
* @event _converse#chatBoxMaximized
|
|
|
* @type {object}
|
|
|
- * @property {_converse.ChatRoom} room
|
|
|
+ * @property {MUC} room
|
|
|
* @property {string} recipient - The JID of the person being invited
|
|
|
* @property {string} reason - The original reason for the invitation
|
|
|
* @example _converse.api.listen.on('chatBoxMaximized', view => { ... });
|
|
@@ -1136,9 +1141,9 @@ class MUC extends ChatBox {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Refresh the disco identity, features and fields for this {@link _converse.ChatRoom}.
|
|
|
- * *features* are stored on the features {@link Model} attribute on this {@link _converse.ChatRoom}.
|
|
|
- * *fields* are stored on the config {@link Model} attribute on this {@link _converse.ChatRoom}.
|
|
|
+ * Refresh the disco identity, features and fields for this {@link MUC}.
|
|
|
+ * *features* are stored on the features {@link Model} attribute on this {@link MUC}.
|
|
|
+ * *fields* are stored on the config {@link Model} attribute on this {@link MUC}.
|
|
|
* @private
|
|
|
* @returns {Promise}
|
|
|
*/
|
|
@@ -1153,7 +1158,7 @@ class MUC extends ChatBox {
|
|
|
* Fetch the *extended* MUC info from the server and cache it locally
|
|
|
* https://xmpp.org/extensions/xep-0045.html#disco-roominfo
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getDiscoInfo
|
|
|
+ * @method MUC#getDiscoInfo
|
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
getDiscoInfo () {
|
|
@@ -1170,7 +1175,7 @@ class MUC extends ChatBox {
|
|
|
* in the `config` {@link Model} attribute.
|
|
|
* See: https://xmpp.org/extensions/xep-0045.html#disco-roominfo
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getDiscoInfoFields
|
|
|
+ * @method MUC#getDiscoInfoFields
|
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
async getDiscoInfoFields () {
|
|
@@ -1187,9 +1192,9 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Use converse-disco to populate the features {@link Model} which
|
|
|
- * is stored as an attibute on this {@link _converse.ChatRoom}.
|
|
|
+ * is stored as an attibute on this {@link MUC}.
|
|
|
* The results may be cached. If you want to force fetching the features from the
|
|
|
- * server, call {@link _converse.ChatRoom#refreshDiscoInfo} instead.
|
|
|
+ * server, call {@link MUC#refreshDiscoInfo} instead.
|
|
|
* @private
|
|
|
* @returns {Promise}
|
|
|
*/
|
|
@@ -1220,7 +1225,7 @@ class MUC extends ChatBox {
|
|
|
* Given a <field> element, return a copy with a <value> child if
|
|
|
* we can find a value for it in this rooms config.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#addFieldValue
|
|
|
+ * @method MUC#addFieldValue
|
|
|
* @returns { Element }
|
|
|
*/
|
|
|
addFieldValue (field) {
|
|
@@ -1251,7 +1256,7 @@ class MUC extends ChatBox {
|
|
|
* Automatically configure the groupchat based on this model's
|
|
|
* 'roomconfig' data.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#autoConfigureChatRoom
|
|
|
+ * @method MUC#autoConfigureChatRoom
|
|
|
* @returns { Promise<Element> }
|
|
|
* Returns a promise which resolves once a response IQ has
|
|
|
* been received.
|
|
@@ -1270,7 +1275,7 @@ class MUC extends ChatBox {
|
|
|
* Returns a promise which resolves once the response IQ
|
|
|
* has been received.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#fetchRoomConfiguration
|
|
|
+ * @method MUC#fetchRoomConfiguration
|
|
|
* @returns { Promise<Element> }
|
|
|
*/
|
|
|
fetchRoomConfiguration () {
|
|
@@ -1280,7 +1285,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Sends an IQ stanza with the groupchat configuration.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#sendConfiguration
|
|
|
+ * @method MUC#sendConfiguration
|
|
|
* @param { Array } config - The groupchat configuration
|
|
|
* @returns { Promise<Element> } - A promise which resolves with
|
|
|
* the `result` stanza received from the XMPP server.
|
|
@@ -1417,7 +1422,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Returns the `role` which the current user has in this MUC
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getOwnRole
|
|
|
+ * @method MUC#getOwnRole
|
|
|
* @returns { ('none'|'visitor'|'participant'|'moderator') }
|
|
|
*/
|
|
|
getOwnRole () {
|
|
@@ -1427,7 +1432,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Returns the `affiliation` which the current user has in this MUC
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getOwnAffiliation
|
|
|
+ * @method MUC#getOwnAffiliation
|
|
|
* @returns { ('none'|'outcast'|'member'|'admin'|'owner') }
|
|
|
*/
|
|
|
getOwnAffiliation () {
|
|
@@ -1437,7 +1442,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Get the {@link _converse.ChatRoomOccupant} instance which
|
|
|
* represents the current user.
|
|
|
- * @method _converse.ChatRoom#getOwnOccupant
|
|
|
+ * @method MUC#getOwnOccupant
|
|
|
* @returns { _converse.ChatRoomOccupant }
|
|
|
*/
|
|
|
getOwnOccupant () {
|
|
@@ -1479,7 +1484,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Send an IQ stanza to modify an occupant's role
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#setRole
|
|
|
+ * @method MUC#setRole
|
|
|
* @param { _converse.ChatRoomOccupant } occupant
|
|
|
* @param { String } role
|
|
|
* @param { String } reason
|
|
@@ -1508,7 +1513,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getOccupant
|
|
|
+ * @method MUC#getOccupant
|
|
|
* @param { String } nickname_or_jid - The nickname or JID of the occupant to be returned
|
|
|
* @returns { _converse.ChatRoomOccupant }
|
|
|
*/
|
|
@@ -1521,7 +1526,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Return an array of occupant models that have the required role
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getOccupantsWithRole
|
|
|
+ * @method MUC#getOccupantsWithRole
|
|
|
* @param { String } role
|
|
|
* @returns { _converse.ChatRoomOccupant[] }
|
|
|
*/
|
|
@@ -1540,7 +1545,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Return an array of occupant models that have the required affiliation
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getOccupantsWithAffiliation
|
|
|
+ * @method MUC#getOccupantsWithAffiliation
|
|
|
* @param { String } affiliation
|
|
|
* @returns { _converse.ChatRoomOccupant[] }
|
|
|
*/
|
|
@@ -1559,7 +1564,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Return an array of occupant models, sorted according to the passed-in attribute.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getOccupantsSortedBy
|
|
|
+ * @method MUC#getOccupantsSortedBy
|
|
|
* @param { String } attr - The attribute to sort the returned array by
|
|
|
* @returns { _converse.ChatRoomOccupant[] }
|
|
|
*/
|
|
@@ -1575,7 +1580,7 @@ class MUC extends ChatBox {
|
|
|
* the passed in members, and if it exists, send the delta
|
|
|
* to the XMPP server to update the member list.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#updateMemberLists
|
|
|
+ * @method MUC#updateMemberLists
|
|
|
* @param { object } members - Map of member jids and affiliations.
|
|
|
* @returns { Promise }
|
|
|
* A promise which is resolved once the list has been
|
|
@@ -1596,7 +1601,7 @@ class MUC extends ChatBox {
|
|
|
* for a server-side reserved nickname or default configured
|
|
|
* nickname and if found, persist that to the model state.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getAndPersistNickname
|
|
|
+ * @method MUC#getAndPersistNickname
|
|
|
* @returns { Promise<string> } A promise which resolves with the nickname
|
|
|
*/
|
|
|
async getAndPersistNickname (nick) {
|
|
@@ -1610,7 +1615,7 @@ class MUC extends ChatBox {
|
|
|
* this user has a reserved nickname for this groupchat.
|
|
|
* If so, we'll use that, otherwise we render the nickname form.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#getReservedNick
|
|
|
+ * @method MUC#getReservedNick
|
|
|
* @returns { Promise<string> } A promise which resolves with the reserved nick or null
|
|
|
*/
|
|
|
async getReservedNick () {
|
|
@@ -1638,7 +1643,7 @@ class MUC extends ChatBox {
|
|
|
* users from using it in this MUC.
|
|
|
* See https://xmpp.org/extensions/xep-0045.html#register
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#registerNickname
|
|
|
+ * @method MUC#registerNickname
|
|
|
*/
|
|
|
async registerNickname () {
|
|
|
const { __ } = _converse;
|
|
@@ -1691,8 +1696,8 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Check whether we should unregister the user from this MUC, and if so,
|
|
|
- * call { @link _converse.ChatRoom#sendUnregistrationIQ }
|
|
|
- * @method _converse.ChatRoom#unregisterNickname
|
|
|
+ * call { @link MUC#sendUnregistrationIQ }
|
|
|
+ * @method MUC#unregisterNickname
|
|
|
*/
|
|
|
async unregisterNickname () {
|
|
|
if (api.settings.get('auto_register_muc_nickname') === 'unregister') {
|
|
@@ -1711,7 +1716,7 @@ class MUC extends ChatBox {
|
|
|
* If the user had a 'member' affiliation, it'll be removed and their
|
|
|
* nickname will no longer be reserved and can instead be used (and
|
|
|
* registered) by other users.
|
|
|
- * @method _converse.ChatRoom#sendUnregistrationIQ
|
|
|
+ * @method MUC#sendUnregistrationIQ
|
|
|
*/
|
|
|
sendUnregistrationIQ () {
|
|
|
const iq = $iq({ 'to': this.get('jid'), 'type': 'set' })
|
|
@@ -1723,7 +1728,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Given a presence stanza, update the occupant model based on its contents.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#updateOccupantsOnPresence
|
|
|
+ * @method MUC#updateOccupantsOnPresence
|
|
|
* @param { Element } pres - The presence stanza
|
|
|
*/
|
|
|
updateOccupantsOnPresence (pres) {
|
|
@@ -1790,7 +1795,7 @@ class MUC extends ChatBox {
|
|
|
* Given two JIDs, which can be either user JIDs or MUC occupant JIDs,
|
|
|
* determine whether they belong to the same user.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#isSameUser
|
|
|
+ * @method MUC#isSameUser
|
|
|
* @param { String } jid1
|
|
|
* @param { String } jid2
|
|
|
* @returns { Boolean }
|
|
@@ -1842,7 +1847,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Handle a possible subject change and return `true` if so.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#handleSubjectChange
|
|
|
+ * @method MUC#handleSubjectChange
|
|
|
* @param { object } attrs - Attributes representing a received
|
|
|
* message, as returned by {@link parseMUCMessage}
|
|
|
*/
|
|
@@ -1877,9 +1882,9 @@ class MUC extends ChatBox {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Set the subject for this {@link _converse.ChatRoom}
|
|
|
+ * Set the subject for this {@link MUC}
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#setSubject
|
|
|
+ * @method MUC#setSubject
|
|
|
* @param { String } value
|
|
|
*/
|
|
|
setSubject (value = '') {
|
|
@@ -1899,7 +1904,7 @@ class MUC extends ChatBox {
|
|
|
* Is this a chat state notification that can be ignored,
|
|
|
* because it's old or because it's from us.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#ignorableCSN
|
|
|
+ * @method MUC#ignorableCSN
|
|
|
* @param { Object } attrs - The message attributes
|
|
|
*/
|
|
|
ignorableCSN (attrs) {
|
|
@@ -1909,7 +1914,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Determines whether the message is from ourselves by checking
|
|
|
* the `from` attribute. Doesn't check the `type` attribute.
|
|
|
- * @method _converse.ChatRoom#isOwnMessage
|
|
|
+ * @method MUC#isOwnMessage
|
|
|
* @param {Object|Element|_converse.Message} msg
|
|
|
* @returns {boolean}
|
|
|
*/
|
|
@@ -1946,7 +1951,7 @@ class MUC extends ChatBox {
|
|
|
* whether we're still joined.
|
|
|
* @async
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#isJoined
|
|
|
+ * @method MUC#isJoined
|
|
|
* @returns {Promise<boolean>}
|
|
|
*/
|
|
|
async isJoined () {
|
|
@@ -1962,7 +1967,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Sends a status update presence (i.e. based on the `<show>` element)
|
|
|
- * @method _converse.ChatRoom#sendStatusPresence
|
|
|
+ * @method MUC#sendStatusPresence
|
|
|
* @param { String } type
|
|
|
* @param { String } [status] - An optional status message
|
|
|
* @param { Element[]|Strophe.Builder[]|Element|Strophe.Builder } [child_nodes]
|
|
@@ -1978,7 +1983,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Check whether we're still joined and re-join if not
|
|
|
- * @method _converse.ChatRoom#rejoinIfNecessary
|
|
|
+ * @method MUC#rejoinIfNecessary
|
|
|
*/
|
|
|
async rejoinIfNecessary () {
|
|
|
if (this.isRAICandidate()) {
|
|
@@ -1994,7 +1999,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#shouldShowErrorMessage
|
|
|
+ * @method MUC#shouldShowErrorMessage
|
|
|
* @returns {Promise<boolean>}
|
|
|
*/
|
|
|
async shouldShowErrorMessage (attrs) {
|
|
@@ -2017,7 +2022,7 @@ class MUC extends ChatBox {
|
|
|
* it probably hasn't been applied to anything yet, given that
|
|
|
* the relevant message is only coming in now.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#findDanglingModeration
|
|
|
+ * @method MUC#findDanglingModeration
|
|
|
* @param { object } attrs - Attributes representing a received
|
|
|
* message, as returned by {@link parseMUCMessage}
|
|
|
* @returns { _converse.ChatRoomMessage }
|
|
@@ -2048,7 +2053,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Handles message moderation based on the passed in attributes.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#handleModeration
|
|
|
+ * @method MUC#handleModeration
|
|
|
* @param {object} attrs - Attributes representing a received
|
|
|
* message, as returned by {@link parseMUCMessage}
|
|
|
* @returns {Promise<boolean>} Returns `true` or `false` depending on
|
|
@@ -2249,7 +2254,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Returns an already cached message (if it exists) based on the
|
|
|
* passed in attributes map.
|
|
|
- * @method _converse.ChatRoom#getDuplicateMessage
|
|
|
+ * @method MUC#getDuplicateMessage
|
|
|
* @param { object } attrs - Attributes representing a received
|
|
|
* message, as returned by {@link parseMUCMessage}
|
|
|
* @returns {Promise<_converse.Message>}
|
|
@@ -2265,9 +2270,9 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Handler for all MUC messages sent to this groupchat. This method
|
|
|
- * shouldn't be called directly, instead {@link _converse.ChatRoom#queueMessage}
|
|
|
+ * shouldn't be called directly, instead {@link MUC#queueMessage}
|
|
|
* should be called.
|
|
|
- * @method _converse.ChatRoom#onMessage
|
|
|
+ * @method MUC#onMessage
|
|
|
* @param { MessageAttributes } attrs - A promise which resolves to the message attributes.
|
|
|
*/
|
|
|
async onMessage (attrs) {
|
|
@@ -2461,7 +2466,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Create an info message based on a received MUC status code
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#createInfoMessage
|
|
|
+ * @method MUC#createInfoMessage
|
|
|
* @param { string } code - The MUC status code
|
|
|
* @param { Element } stanza - The original stanza that contains the code
|
|
|
* @param { Boolean } is_self - Whether this stanza refers to our own presence
|
|
@@ -2505,7 +2510,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Create info messages based on a received presence or message stanza
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#createInfoMessages
|
|
|
+ * @method MUC#createInfoMessages
|
|
|
* @param { Element } stanza
|
|
|
*/
|
|
|
createInfoMessages (stanza) {
|
|
@@ -2559,7 +2564,7 @@ class MUC extends ChatBox {
|
|
|
|
|
|
/**
|
|
|
* Parses a <presence> stanza with type "error" and sets the proper
|
|
|
- * `connection_status` value for this {@link _converse.ChatRoom} as
|
|
|
+ * `connection_status` value for this {@link MUC} as
|
|
|
* well as any additional output that can be shown to the user.
|
|
|
* @private
|
|
|
* @param { Element } stanza - The presence stanza
|
|
@@ -2626,7 +2631,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Listens for incoming presence stanzas from the service that hosts this MUC
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#onPresenceFromMUCHost
|
|
|
+ * @method MUC#onPresenceFromMUCHost
|
|
|
* @param { Element } stanza - The presence stanza
|
|
|
*/
|
|
|
onPresenceFromMUCHost (stanza) {
|
|
@@ -2645,7 +2650,7 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Handles incoming presence stanzas coming from the MUC
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#onPresence
|
|
|
+ * @method MUC#onPresence
|
|
|
* @param { Element } stanza
|
|
|
*/
|
|
|
onPresence (stanza) {
|
|
@@ -2678,7 +2683,7 @@ class MUC extends ChatBox {
|
|
|
* auto-configured only if applicable and if the current
|
|
|
* user is the groupchat's owner.
|
|
|
* @private
|
|
|
- * @method _converse.ChatRoom#onOwnPresence
|
|
|
+ * @method MUC#onOwnPresence
|
|
|
* @param { Element } pres - The stanza
|
|
|
*/
|
|
|
async onOwnPresence (stanza) {
|
|
@@ -2719,9 +2724,8 @@ class MUC extends ChatBox {
|
|
|
/**
|
|
|
* Returns a boolean to indicate whether the current user
|
|
|
* was mentioned in a message.
|
|
|
- * @private
|
|
|
- * @method _converse.ChatRoom#isUserMentioned
|
|
|
- * @param { String } - The text message
|
|
|
+ * @method MUC#isUserMentioned
|
|
|
+ * @param {MUCMessage} message - The text message
|
|
|
*/
|
|
|
isUserMentioned (message) {
|
|
|
const nick = this.get('nick');
|