Converse converse.js

Namespace: ChatRoom

_converse.ChatRoom

Represents an open/ongoing groupchat conversation.

Source:

Methods

(private) addFieldValue() → {Element}

Given a element, return a copy with a child if we can find a value for it in this rooms config.

Source:
Returns:
Type
Element

(private) addFieldValue() → {Element}

Given a element, return a copy with a child if we can find a value for it in this rooms config.

Source:
Returns:
Type
Element

(private) autoConfigureChatRoom() → {Promise.<Element>}

Automatically configure the groupchat based on this model's 'roomconfig' data.

Source:
Returns:

Returns a promise which resolves once a response IQ has been received.

Type
Promise.<Element>

(private) autoConfigureChatRoom() → {Promise.<Element>}

Automatically configure the groupchat based on this model's 'roomconfig' data.

Source:
Returns:

Returns a promise which resolves once a response IQ has been received.

Type
Promise.<Element>

(private) createInfoMessage(code, stanza, is_self)

Create an info message based on a received MUC status code

Parameters:
Name Type Description
code string

The MUC status code

stanza Element

The original stanza that contains the code

is_self Boolean

Whether this stanza refers to our own presence

Source:

(private) createInfoMessage(code, stanza, is_self)

Create an info message based on a received MUC status code

Parameters:
Name Type Description
code string

The MUC status code

stanza Element

The original stanza that contains the code

is_self Boolean

Whether this stanza refers to our own presence

Source:

(private) createInfoMessages(stanza)

Create info messages based on a received presence or message stanza

Parameters:
Name Type Description
stanza Element
Source:

(private) createInfoMessages(stanza)

Create info messages based on a received presence or message stanza

Parameters:
Name Type Description
stanza Element
Source:

(private) directInvite(recipient, reasonopt)

Send a direct invitation as per XEP-0249

Parameters:
Name Type Attributes Description
recipient String

JID of the person being invited

reason String <optional>

Reason for the invitation

Source:

(private) directInvite(recipient, reasonopt)

Send a direct invitation as per XEP-0249

Parameters:
Name Type Attributes Description
recipient String

JID of the person being invited

reason String <optional>

Reason for the invitation

Source:

(private) enableRAI()

Ensures that the user is subscribed to XEP-0437 Room Activity Indicators if muc_subscribe_to_rai is set to true. Only affiliated users can subscribe to RAI, but this method doesn't check whether the current user is affiliated because it's intended to be called after the MUC has been left and we don't have that information anymore.

Source:

(private) enableRAI()

Ensures that the user is subscribed to XEP-0437 Room Activity Indicators if muc_subscribe_to_rai is set to true. Only affiliated users can subscribe to RAI, but this method doesn't check whether the current user is affiliated because it's intended to be called after the MUC has been left and we don't have that information anymore.

Source:

(private) fetchRoomConfiguration() → {Promise.<Element>}

Send an IQ stanza to fetch the groupchat configuration data. Returns a promise which resolves once the response IQ has been received.

Source:
Returns:
Type
Promise.<Element>

(private) fetchRoomConfiguration() → {Promise.<Element>}

Send an IQ stanza to fetch the groupchat configuration data. Returns a promise which resolves once the response IQ has been received.

Source:
Returns:
Type
Promise.<Element>

(private) findDanglingModeration(attrs) → {_converse.ChatRoomMessage}

Looks whether we already have a moderation message for this incoming message. If so, it's considered "dangling" because it probably hasn't been applied to anything yet, given that the relevant message is only coming in now.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
_converse.ChatRoomMessage

(private) findDanglingModeration(attrs) → {_converse.ChatRoomMessage}

Looks whether we already have a moderation message for this incoming message. If so, it's considered "dangling" because it probably hasn't been applied to anything yet, given that the relevant message is only coming in now.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
_converse.ChatRoomMessage

(private) getAllKnownNicknames() → {Array.<String>}

Return an array of unique nicknames based on all occupants and messages in this MUC.

Source:
Returns:
Type
Array.<String>

(private) getAllKnownNicknames() → {Array.<String>}

Return an array of unique nicknames based on all occupants and messages in this MUC.

Source:
Returns:
Type
Array.<String>

(private) getAndPersistNickname() → {Promise.<string>}

Given a nick name, save it to the model state, otherwise, look for a server-side reserved nickname or default configured nickname and if found, persist that to the model state.

Source:
Returns:

A promise which resolves with the nickname

Type
Promise.<string>

(private) getAndPersistNickname() → {Promise.<string>}

Given a nick name, save it to the model state, otherwise, look for a server-side reserved nickname or default configured nickname and if found, persist that to the model state.

Source:
Returns:

A promise which resolves with the nickname

Type
Promise.<string>

(private) getDiscoInfo() → {Promise}

Fetch the extended MUC info from the server and cache it locally https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

(private) getDiscoInfo() → {Promise}

Fetch the extended MUC info from the server and cache it locally https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

(private) getDiscoInfoFields() → {Promise}

Fetch the extended MUC info fields from the server and store them locally in the config Model attribute. See: https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

(private) getDiscoInfoFields() → {Promise}

Fetch the extended MUC info fields from the server and store them locally in the config Model attribute. See: https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

getDuplicateMessage(attrs) → {Promise.<_converse.Message>}

Returns an already cached message (if it exists) based on the passed in attributes map.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
Promise.<_converse.Message>

getDuplicateMessage(attrs) → {Promise.<_converse.Message>}

Returns an already cached message (if it exists) based on the passed in attributes map.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
Promise.<_converse.Message>

(private) getOccupant(nickname_or_jid) → {_converse.ChatRoomOccupant}

Parameters:
Name Type Description
nickname_or_jid String

The nickname or JID of the occupant to be returned

Source:
Returns:
Type
_converse.ChatRoomOccupant

(private) getOccupant(nickname_or_jid) → {_converse.ChatRoomOccupant}

Parameters:
Name Type Description
nickname_or_jid String

The nickname or JID of the occupant to be returned

Source:
Returns:
Type
_converse.ChatRoomOccupant

(private) getOccupantsSortedBy(attr) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models, sorted according to the passed-in attribute.

Parameters:
Name Type Description
attr String

The attribute to sort the returned array by

Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsSortedBy(attr) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models, sorted according to the passed-in attribute.

Parameters:
Name Type Description
attr String

The attribute to sort the returned array by

Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithAffiliation(affiliation) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required affiliation

Parameters:
Name Type Description
affiliation String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithAffiliation(affiliation) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required affiliation

Parameters:
Name Type Description
affiliation String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithRole(role) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required role

Parameters:
Name Type Description
role String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithRole(role) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required role

Parameters:
Name Type Description
role String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOwnAffiliation() → {'none'|'outcast'|'member'|'admin'|'owner'}

Returns the affiliation which the current user has in this MUC

Source:
Returns:
Type
'none' | 'outcast' | 'member' | 'admin' | 'owner'

(private) getOwnAffiliation() → {'none'|'outcast'|'member'|'admin'|'owner'}

Returns the affiliation which the current user has in this MUC

Source:
Returns:
Type
'none' | 'outcast' | 'member' | 'admin' | 'owner'

getOwnOccupant() → {_converse.ChatRoomOccupant}

Get the _converse.ChatRoomOccupant instance which represents the current user.

Source:
Returns:
Type
_converse.ChatRoomOccupant

getOwnOccupant() → {_converse.ChatRoomOccupant}

Get the _converse.ChatRoomOccupant instance which represents the current user.

Source:
Returns:
Type
_converse.ChatRoomOccupant

(private) getOwnRole() → {'none'|'visitor'|'participant'|'moderator'}

Returns the role which the current user has in this MUC

Source:
Returns:
Type
'none' | 'visitor' | 'participant' | 'moderator'

(private) getOwnRole() → {'none'|'visitor'|'participant'|'moderator'}

Returns the role which the current user has in this MUC

Source:
Returns:
Type
'none' | 'visitor' | 'participant' | 'moderator'

(private) getReservedNick() → {Promise.<string>}

Use service-discovery to ask the XMPP server whether this user has a reserved nickname for this groupchat. If so, we'll use that, otherwise we render the nickname form.

Source:
Returns:

A promise which resolves with the reserved nick or null

Type
Promise.<string>

(private) getReservedNick() → {Promise.<string>}

Use service-discovery to ask the XMPP server whether this user has a reserved nickname for this groupchat. If so, we'll use that, otherwise we render the nickname form.

Source:
Returns:

A promise which resolves with the reserved nick or null

Type
Promise.<string>

(private) getRoomJIDAndNick() → {string}

Utility method to construct the JID for the current user as occupant of the groupchat.

Source:
Returns:
  • The groupchat JID with the user's nickname added at the end.
Type
string
Example
groupchat@conference.example.org/nickname

(private) getRoomJIDAndNick() → {string}

Utility method to construct the JID for the current user as occupant of the groupchat.

Source:
Returns:
  • The groupchat JID with the user's nickname added at the end.
Type
string
Example
groupchat@conference.example.org/nickname

(private) handleForwardedMentions(stanza)

Handles XEP-0452 MUC Mention Notification messages

Parameters:
Name Type Description
stanza Element
Source:

(private) handleForwardedMentions(stanza)

Handles XEP-0452 MUC Mention Notification messages

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageFromMUCHost(stanza)

Handles incoming message stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageFromMUCHost(stanza)

Handles incoming message stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageStanza(stanza)

Parses an incoming message stanza and queues it for processing.

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageStanza(stanza)

Parses an incoming message stanza and queues it for processing.

Parameters:
Name Type Description
stanza Element
Source:

(private) handleModeration(attrs) → {Boolean}

Handles message moderation based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:

Returns true or false depending on whether a message was moderated or not.

Type
Boolean

(private) handleModeration(attrs) → {Boolean}

Handles message moderation based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:

Returns true or false depending on whether a message was moderated or not.

Type
Boolean

(private) handleSubjectChange(attrs)

Handle a possible subject change and return true if so.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:

(private) handleSubjectChange(attrs)

Handle a possible subject change and return true if so.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:

(private) ignorableCSN(attrs)

Is this a chat state notification that can be ignored, because it's old or because it's from us.

Parameters:
Name Type Description
attrs Object

The message attributes

Source:

(private) ignorableCSN(attrs)

Is this a chat state notification that can be ignored, because it's old or because it's from us.

Parameters:
Name Type Description
attrs Object

The message attributes

Source:

(async, private) isJoined() → {Promise.<boolean>}

Send a MUC-0410 MUC Self-Ping stanza to room to determine whether we're still joined.

Source:
Returns:
Type
Promise.<boolean>

(async, private) isJoined() → {Promise.<boolean>}

Send a MUC-0410 MUC Self-Ping stanza to room to determine whether we're still joined.

Source:
Returns:
Type
Promise.<boolean>

(private) isOwnMessage(msg) → {boolean}

Determines whether the message is from ourselves by checking the from attribute. Doesn't check the type attribute.

Parameters:
Name Type Description
msg Object | Element | _converse.Message
Source:
Returns:
Type
boolean

(private) isOwnMessage(msg) → {boolean}

Determines whether the message is from ourselves by checking the from attribute. Doesn't check the type attribute.

Parameters:
Name Type Description
msg Object | Element | _converse.Message
Source:
Returns:
Type
boolean

isRAICandidate() → {Boolean}

Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)

Source:
Returns:
Type
Boolean

isRAICandidate() → {Boolean}

Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)

Source:
Returns:
Type
Boolean

(private) isSameUser(jid1, jid2) → {Boolean}

Given two JIDs, which can be either user JIDs or MUC occupant JIDs, determine whether they belong to the same user.

Parameters:
Name Type Description
jid1 String
jid2 String
Source:
Returns:
Type
Boolean

(private) isSameUser(jid1, jid2) → {Boolean}

Given two JIDs, which can be either user JIDs or MUC occupant JIDs, determine whether they belong to the same user.

Parameters:
Name Type Description
jid1 String
jid2 String
Source:
Returns:
Type
Boolean

(private) isUserMentioned()

Returns a boolean to indicate whether the current user was mentioned in a message.

Parameters:
Type Description
String

The text message

Source:

(private) isUserMentioned()

Returns a boolean to indicate whether the current user was mentioned in a message.

Parameters:
Type Description
String

The text message

Source:

(private) join(nick, passwordopt)

Join the MUC

Parameters:
Name Type Attributes Description
nick String

The user's nickname

password String <optional>

Optional password, if required by the groupchat. Will fall back to the password value stored in the room model (if available).

Source:

(private) join(nick, passwordopt)

Join the MUC

Parameters:
Name Type Attributes Description
nick String

The user's nickname

password String <optional>

Optional password, if required by the groupchat. Will fall back to the password value stored in the room model (if available).

Source:

(private) leave(exit_msgopt)

Leave the groupchat.

Parameters:
Name Type Attributes Description
exit_msg string <optional>

Message to indicate your reason for leaving

Source:

(private) leave(exit_msgopt)

Leave the groupchat.

Parameters:
Name Type Attributes Description
exit_msg string <optional>

Message to indicate your reason for leaving

Source:

(private) onDirectMUCInvitation(message)

A direct MUC invitation to join a groupchat has been received See XEP-0249: Direct MUC invitations.

Parameters:
Name Type Description
message Element

The message stanza containing the invitation.

Source:

(private) onDirectMUCInvitation(message)

A direct MUC invitation to join a groupchat has been received See XEP-0249: Direct MUC invitations.

Parameters:
Name Type Description
message Element

The message stanza containing the invitation.

Source:

(private) onHiddenChange()

Handler that gets called when the 'hidden' flag is toggled.

Source:

(private) onHiddenChange()

Handler that gets called when the 'hidden' flag is toggled.

Source:

onMessage(attrs)

Handler for all MUC messages sent to this groupchat. This method shouldn't be called directly, instead _converse.ChatRoom#queueMessage should be called.

Parameters:
Name Type Description
attrs MessageAttributes

A promise which resolves to the message attributes.

Source:

onMessage(attrs)

Handler for all MUC messages sent to this groupchat. This method shouldn't be called directly, instead _converse.ChatRoom#queueMessage should be called.

Parameters:
Name Type Description
attrs MessageAttributes

A promise which resolves to the message attributes.

Source:

(private) onOwnPresence(pres)

Handles a received presence relating to the current user.

For locked groupchats (which are by definition "new"), the groupchat will either be auto-configured or created instantly (with default config) or a configuration groupchat will be rendered.

If the groupchat is not locked, then the groupchat will be auto-configured only if applicable and if the current user is the groupchat's owner.

Parameters:
Name Type Description
pres Element

The stanza

Source:

(private) onOwnPresence(pres)

Handles a received presence relating to the current user.

For locked groupchats (which are by definition "new"), the groupchat will either be auto-configured or created instantly (with default config) or a configuration groupchat will be rendered.

If the groupchat is not locked, then the groupchat will be auto-configured only if applicable and if the current user is the groupchat's owner.

Parameters:
Name Type Description
pres Element

The stanza

Source:

(private) onPresence(stanza)

Handles incoming presence stanzas coming from the MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) onPresence(stanza)

Handles incoming presence stanzas coming from the MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) onPresenceFromMUCHost(stanza)

Listens for incoming presence stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element

The presence stanza

Source:

(private) onPresenceFromMUCHost(stanza)

Listens for incoming presence stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element

The presence stanza

Source:

(private) registerHandlers()

Register presence and message handlers relevant to this groupchat

Source:

(private) registerHandlers()

Register presence and message handlers relevant to this groupchat

Source:

(private) registerNickname()

Send an IQ stanza to the MUC to register this user's nickname. This sets the user's affiliation to 'member' (if they weren't affiliated before) and reserves the nickname for this user, thereby preventing other users from using it in this MUC. See https://xmpp.org/extensions/xep-0045.html#register

Source:

(private) registerNickname()

Send an IQ stanza to the MUC to register this user's nickname. This sets the user's affiliation to 'member' (if they weren't affiliated before) and reserves the nickname for this user, thereby preventing other users from using it in this MUC. See https://xmpp.org/extensions/xep-0045.html#register

Source:

(private) rejoin()

Clear stale cache and re-join a MUC we've been in before.

Source:

(private) rejoin()

Clear stale cache and re-join a MUC we've been in before.

Source:

rejoinIfNecessary()

Check whether we're still joined and re-join if not

Source:

rejoinIfNecessary()

Check whether we're still joined and re-join if not

Source:

(private) restoreFromCache() → {Boolean}

Checks whether we're still joined and if so, restores the MUC state from cache.

Source:
Returns:

Returns true if we're still joined, otherwise returns false.

Type
Boolean

(private) restoreFromCache() → {Boolean}

Checks whether we're still joined and if so, restores the MUC state from cache.

Source:
Returns:

Returns true if we're still joined, otherwise returns false.

Type
Boolean

(private) retractOtherMessage(message, reasonopt)

Retract someone else's message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:
Example
const room = await api.rooms.get(jid);
 const message = room.messages.findWhere({'body': 'Get rich quick!'});
 room.retractOtherMessage(message, 'spam');

(private) retractOtherMessage(message, reasonopt)

Retract someone else's message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:
Example
const room = await api.rooms.get(jid);
 const message = room.messages.findWhere({'body': 'Get rich quick!'});
 room.retractOtherMessage(message, 'spam');

(private) retractOwnMessage(message)

Retract one of your messages in this groupchat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) retractOwnMessage(message)

Retract one of your messages in this groupchat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) sendChatState()

Sends a message with the current XEP-0085 chat state of the user as taken from the chat_state attribute of the _converse.ChatRoom.

Source:

(private) sendChatState()

Sends a message with the current XEP-0085 chat state of the user as taken from the chat_state attribute of the _converse.ChatRoom.

Source:

(private) sendConfiguration(config) → {Promise.<Element>}

Sends an IQ stanza with the groupchat configuration.

Parameters:
Name Type Description
config Array

The groupchat configuration

Source:
Returns:
  • A promise which resolves with the result stanza received from the XMPP server.
Type
Promise.<Element>

(private) sendConfiguration(config) → {Promise.<Element>}

Sends an IQ stanza with the groupchat configuration.

Parameters:
Name Type Description
config Array

The groupchat configuration

Source:
Returns:
  • A promise which resolves with the result stanza received from the XMPP server.
Type
Promise.<Element>

(private) sendDestroyIQ(reasonopt, new_jidopt)

Sends an IQ stanza to the XMPP server to destroy this groupchat. Not to be confused with the _converse.ChatRoom#destroy method, which simply removes the room from the local browser storage cache.

Parameters:
Name Type Attributes Description
reason string <optional>

The reason for destroying the groupchat.

new_jid string <optional>

The JID of the new groupchat which replaces this one.

Source:

(private) sendDestroyIQ(reasonopt, new_jidopt)

Sends an IQ stanza to the XMPP server to destroy this groupchat. Not to be confused with the _converse.ChatRoom#destroy method, which simply removes the room from the local browser storage cache.

Parameters:
Name Type Attributes Description
reason string <optional>

The reason for destroying the groupchat.

new_jid string <optional>

The JID of the new groupchat which replaces this one.

Source:

(private) sendRetractionIQ(message, reasonopt)

Sends an IQ stanza to the XMPP server to retract a message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:

(private) sendRetractionIQ(message, reasonopt)

Sends an IQ stanza to the XMPP server to retract a message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:

sendStatusPresence(type, statusopt, child_nodesopt)

Sends a status update presence (i.e. based on the <show> element)

Parameters:
Name Type Attributes Description
type String
status String <optional>

An optional status message

child_nodes Array.<Element> | Array.<Strophe.Builder> | Element | Strophe.Builder <optional>

Nodes(s) to be added as child nodes of the presence XML element.

Source:

sendStatusPresence(type, statusopt, child_nodesopt)

Sends a status update presence (i.e. based on the <show> element)

Parameters:
Name Type Attributes Description
type String
status String <optional>

An optional status message

child_nodes Array.<Element> | Array.<Strophe.Builder> | Element | Strophe.Builder <optional>

Nodes(s) to be added as child nodes of the presence XML element.

Source:

(private) sendTimedMessage(message) → {Promise.<Element>|Promise.<TimeoutError>}

Sends a message stanza to the XMPP server and expects a reflection or error message within a specific timeout period.

Parameters:
Name Type Description
message _converse.Message | Element
Source:
Returns:

Returns a promise which resolves with the reflected message stanza or with an error stanza or TimeoutError.

Type
Promise.<Element> | Promise.<TimeoutError>

(private) sendTimedMessage(message) → {Promise.<Element>|Promise.<TimeoutError>}

Sends a message stanza to the XMPP server and expects a reflection or error message within a specific timeout period.

Parameters:
Name Type Description
message _converse.Message | Element
Source:
Returns:

Returns a promise which resolves with the reflected message stanza or with an error stanza or TimeoutError.

Type
Promise.<Element> | Promise.<TimeoutError>

sendUnregistrationIQ()

Send an IQ stanza to the MUC to unregister this user's nickname. 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.

Source:

sendUnregistrationIQ()

Send an IQ stanza to the MUC to unregister this user's nickname. 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.

Source:

(private) setRole(occupant, role, reason, onSuccess, onError)

Send an IQ stanza to modify an occupant's role

Parameters:
Name Type Description
occupant _converse.ChatRoomOccupant
role String
reason String
onSuccess function

callback for a succesful response

onError function

callback for an error response

Source:

(private) setRole(occupant, role, reason, onSuccess, onError)

Send an IQ stanza to modify an occupant's role

Parameters:
Name Type Description
occupant _converse.ChatRoomOccupant
role String
reason String
onSuccess function

callback for a succesful response

onError function

callback for an error response

Source:

(private) setSubject(value)

Set the subject for this _converse.ChatRoom

Parameters:
Name Type Description
value String
Source:

(private) setSubject(value)

Set the subject for this _converse.ChatRoom

Parameters:
Name Type Description
value String
Source:

(private) shouldShowErrorMessage() → {Promise.<boolean>}

Source:
Returns:
Type
Promise.<boolean>

(private) shouldShowErrorMessage() → {Promise.<boolean>}

Source:
Returns:
Type
Promise.<boolean>

unregisterNickname()

Check whether we should unregister the user from this MUC, and if so, call { @link _converse.ChatRoom#sendUnregistrationIQ }

Source:

unregisterNickname()

Check whether we should unregister the user from this MUC, and if so, call { @link _converse.ChatRoom#sendUnregistrationIQ }

Source:

(private) updateMemberLists(members) → {Promise}

Fetch the lists of users with the given affiliations. Then compute the delta between those users and the passed in members, and if it exists, send the delta to the XMPP server to update the member list.

Parameters:
Name Type Description
members object

Map of member jids and affiliations.

Source:
Returns:

A promise which is resolved once the list has been updated or once it's been established there's no need to update the list.

Type
Promise

(private) updateMemberLists(members) → {Promise}

Fetch the lists of users with the given affiliations. Then compute the delta between those users and the passed in members, and if it exists, send the delta to the XMPP server to update the member list.

Parameters:
Name Type Description
members object

Map of member jids and affiliations.

Source:
Returns:

A promise which is resolved once the list has been updated or once it's been established there's no need to update the list.

Type
Promise

(private) updateOccupantsOnPresence(pres)

Given a presence stanza, update the occupant model based on its contents.

Parameters:
Name Type Description
pres Element

The presence stanza

Source:

(private) updateOccupantsOnPresence(pres)

Given a presence stanza, update the occupant model based on its contents.

Parameters:
Name Type Description
pres Element

The presence stanza

Source:

_converse.ChatRoom

Represents an open/ongoing groupchat conversation.

Source:

Methods

(private) addFieldValue() → {Element}

Given a element, return a copy with a child if we can find a value for it in this rooms config.

Source:
Returns:
Type
Element

(private) addFieldValue() → {Element}

Given a element, return a copy with a child if we can find a value for it in this rooms config.

Source:
Returns:
Type
Element

(private) autoConfigureChatRoom() → {Promise.<Element>}

Automatically configure the groupchat based on this model's 'roomconfig' data.

Source:
Returns:

Returns a promise which resolves once a response IQ has been received.

Type
Promise.<Element>

(private) autoConfigureChatRoom() → {Promise.<Element>}

Automatically configure the groupchat based on this model's 'roomconfig' data.

Source:
Returns:

Returns a promise which resolves once a response IQ has been received.

Type
Promise.<Element>

(private) createInfoMessage(code, stanza, is_self)

Create an info message based on a received MUC status code

Parameters:
Name Type Description
code string

The MUC status code

stanza Element

The original stanza that contains the code

is_self Boolean

Whether this stanza refers to our own presence

Source:

(private) createInfoMessage(code, stanza, is_self)

Create an info message based on a received MUC status code

Parameters:
Name Type Description
code string

The MUC status code

stanza Element

The original stanza that contains the code

is_self Boolean

Whether this stanza refers to our own presence

Source:

(private) createInfoMessages(stanza)

Create info messages based on a received presence or message stanza

Parameters:
Name Type Description
stanza Element
Source:

(private) createInfoMessages(stanza)

Create info messages based on a received presence or message stanza

Parameters:
Name Type Description
stanza Element
Source:

(private) directInvite(recipient, reasonopt)

Send a direct invitation as per XEP-0249

Parameters:
Name Type Attributes Description
recipient String

JID of the person being invited

reason String <optional>

Reason for the invitation

Source:

(private) directInvite(recipient, reasonopt)

Send a direct invitation as per XEP-0249

Parameters:
Name Type Attributes Description
recipient String

JID of the person being invited

reason String <optional>

Reason for the invitation

Source:

(private) enableRAI()

Ensures that the user is subscribed to XEP-0437 Room Activity Indicators if muc_subscribe_to_rai is set to true. Only affiliated users can subscribe to RAI, but this method doesn't check whether the current user is affiliated because it's intended to be called after the MUC has been left and we don't have that information anymore.

Source:

(private) enableRAI()

Ensures that the user is subscribed to XEP-0437 Room Activity Indicators if muc_subscribe_to_rai is set to true. Only affiliated users can subscribe to RAI, but this method doesn't check whether the current user is affiliated because it's intended to be called after the MUC has been left and we don't have that information anymore.

Source:

(private) fetchRoomConfiguration() → {Promise.<Element>}

Send an IQ stanza to fetch the groupchat configuration data. Returns a promise which resolves once the response IQ has been received.

Source:
Returns:
Type
Promise.<Element>

(private) fetchRoomConfiguration() → {Promise.<Element>}

Send an IQ stanza to fetch the groupchat configuration data. Returns a promise which resolves once the response IQ has been received.

Source:
Returns:
Type
Promise.<Element>

(private) findDanglingModeration(attrs) → {_converse.ChatRoomMessage}

Looks whether we already have a moderation message for this incoming message. If so, it's considered "dangling" because it probably hasn't been applied to anything yet, given that the relevant message is only coming in now.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
_converse.ChatRoomMessage

(private) findDanglingModeration(attrs) → {_converse.ChatRoomMessage}

Looks whether we already have a moderation message for this incoming message. If so, it's considered "dangling" because it probably hasn't been applied to anything yet, given that the relevant message is only coming in now.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
_converse.ChatRoomMessage

(private) getAllKnownNicknames() → {Array.<String>}

Return an array of unique nicknames based on all occupants and messages in this MUC.

Source:
Returns:
Type
Array.<String>

(private) getAllKnownNicknames() → {Array.<String>}

Return an array of unique nicknames based on all occupants and messages in this MUC.

Source:
Returns:
Type
Array.<String>

(private) getAndPersistNickname() → {Promise.<string>}

Given a nick name, save it to the model state, otherwise, look for a server-side reserved nickname or default configured nickname and if found, persist that to the model state.

Source:
Returns:

A promise which resolves with the nickname

Type
Promise.<string>

(private) getAndPersistNickname() → {Promise.<string>}

Given a nick name, save it to the model state, otherwise, look for a server-side reserved nickname or default configured nickname and if found, persist that to the model state.

Source:
Returns:

A promise which resolves with the nickname

Type
Promise.<string>

(private) getDiscoInfo() → {Promise}

Fetch the extended MUC info from the server and cache it locally https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

(private) getDiscoInfo() → {Promise}

Fetch the extended MUC info from the server and cache it locally https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

(private) getDiscoInfoFields() → {Promise}

Fetch the extended MUC info fields from the server and store them locally in the config Model attribute. See: https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

(private) getDiscoInfoFields() → {Promise}

Fetch the extended MUC info fields from the server and store them locally in the config Model attribute. See: https://xmpp.org/extensions/xep-0045.html#disco-roominfo

Source:
Returns:
Type
Promise

getDuplicateMessage(attrs) → {Promise.<_converse.Message>}

Returns an already cached message (if it exists) based on the passed in attributes map.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
Promise.<_converse.Message>

getDuplicateMessage(attrs) → {Promise.<_converse.Message>}

Returns an already cached message (if it exists) based on the passed in attributes map.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:
Type
Promise.<_converse.Message>

(private) getOccupant(nickname_or_jid) → {_converse.ChatRoomOccupant}

Parameters:
Name Type Description
nickname_or_jid String

The nickname or JID of the occupant to be returned

Source:
Returns:
Type
_converse.ChatRoomOccupant

(private) getOccupant(nickname_or_jid) → {_converse.ChatRoomOccupant}

Parameters:
Name Type Description
nickname_or_jid String

The nickname or JID of the occupant to be returned

Source:
Returns:
Type
_converse.ChatRoomOccupant

(private) getOccupantsSortedBy(attr) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models, sorted according to the passed-in attribute.

Parameters:
Name Type Description
attr String

The attribute to sort the returned array by

Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsSortedBy(attr) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models, sorted according to the passed-in attribute.

Parameters:
Name Type Description
attr String

The attribute to sort the returned array by

Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithAffiliation(affiliation) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required affiliation

Parameters:
Name Type Description
affiliation String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithAffiliation(affiliation) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required affiliation

Parameters:
Name Type Description
affiliation String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithRole(role) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required role

Parameters:
Name Type Description
role String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOccupantsWithRole(role) → {Array.<_converse.ChatRoomOccupant>}

Return an array of occupant models that have the required role

Parameters:
Name Type Description
role String
Source:
Returns:
Type
Array.<_converse.ChatRoomOccupant>

(private) getOwnAffiliation() → {'none'|'outcast'|'member'|'admin'|'owner'}

Returns the affiliation which the current user has in this MUC

Source:
Returns:
Type
'none' | 'outcast' | 'member' | 'admin' | 'owner'

(private) getOwnAffiliation() → {'none'|'outcast'|'member'|'admin'|'owner'}

Returns the affiliation which the current user has in this MUC

Source:
Returns:
Type
'none' | 'outcast' | 'member' | 'admin' | 'owner'

getOwnOccupant() → {_converse.ChatRoomOccupant}

Get the _converse.ChatRoomOccupant instance which represents the current user.

Source:
Returns:
Type
_converse.ChatRoomOccupant

getOwnOccupant() → {_converse.ChatRoomOccupant}

Get the _converse.ChatRoomOccupant instance which represents the current user.

Source:
Returns:
Type
_converse.ChatRoomOccupant

(private) getOwnRole() → {'none'|'visitor'|'participant'|'moderator'}

Returns the role which the current user has in this MUC

Source:
Returns:
Type
'none' | 'visitor' | 'participant' | 'moderator'

(private) getOwnRole() → {'none'|'visitor'|'participant'|'moderator'}

Returns the role which the current user has in this MUC

Source:
Returns:
Type
'none' | 'visitor' | 'participant' | 'moderator'

(private) getReservedNick() → {Promise.<string>}

Use service-discovery to ask the XMPP server whether this user has a reserved nickname for this groupchat. If so, we'll use that, otherwise we render the nickname form.

Source:
Returns:

A promise which resolves with the reserved nick or null

Type
Promise.<string>

(private) getReservedNick() → {Promise.<string>}

Use service-discovery to ask the XMPP server whether this user has a reserved nickname for this groupchat. If so, we'll use that, otherwise we render the nickname form.

Source:
Returns:

A promise which resolves with the reserved nick or null

Type
Promise.<string>

(private) getRoomJIDAndNick() → {string}

Utility method to construct the JID for the current user as occupant of the groupchat.

Source:
Returns:
  • The groupchat JID with the user's nickname added at the end.
Type
string
Example
groupchat@conference.example.org/nickname

(private) getRoomJIDAndNick() → {string}

Utility method to construct the JID for the current user as occupant of the groupchat.

Source:
Returns:
  • The groupchat JID with the user's nickname added at the end.
Type
string
Example
groupchat@conference.example.org/nickname

(private) handleForwardedMentions(stanza)

Handles XEP-0452 MUC Mention Notification messages

Parameters:
Name Type Description
stanza Element
Source:

(private) handleForwardedMentions(stanza)

Handles XEP-0452 MUC Mention Notification messages

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageFromMUCHost(stanza)

Handles incoming message stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageFromMUCHost(stanza)

Handles incoming message stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageStanza(stanza)

Parses an incoming message stanza and queues it for processing.

Parameters:
Name Type Description
stanza Element
Source:

(private) handleMessageStanza(stanza)

Parses an incoming message stanza and queues it for processing.

Parameters:
Name Type Description
stanza Element
Source:

(private) handleModeration(attrs) → {Boolean}

Handles message moderation based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:

Returns true or false depending on whether a message was moderated or not.

Type
Boolean

(private) handleModeration(attrs) → {Boolean}

Handles message moderation based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:
Returns:

Returns true or false depending on whether a message was moderated or not.

Type
Boolean

(private) handleSubjectChange(attrs)

Handle a possible subject change and return true if so.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:

(private) handleSubjectChange(attrs)

Handle a possible subject change and return true if so.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMUCMessage

Source:

(private) ignorableCSN(attrs)

Is this a chat state notification that can be ignored, because it's old or because it's from us.

Parameters:
Name Type Description
attrs Object

The message attributes

Source:

(private) ignorableCSN(attrs)

Is this a chat state notification that can be ignored, because it's old or because it's from us.

Parameters:
Name Type Description
attrs Object

The message attributes

Source:

(async, private) isJoined() → {Promise.<boolean>}

Send a MUC-0410 MUC Self-Ping stanza to room to determine whether we're still joined.

Source:
Returns:
Type
Promise.<boolean>

(async, private) isJoined() → {Promise.<boolean>}

Send a MUC-0410 MUC Self-Ping stanza to room to determine whether we're still joined.

Source:
Returns:
Type
Promise.<boolean>

(private) isOwnMessage(msg) → {boolean}

Determines whether the message is from ourselves by checking the from attribute. Doesn't check the type attribute.

Parameters:
Name Type Description
msg Object | Element | _converse.Message
Source:
Returns:
Type
boolean

(private) isOwnMessage(msg) → {boolean}

Determines whether the message is from ourselves by checking the from attribute. Doesn't check the type attribute.

Parameters:
Name Type Description
msg Object | Element | _converse.Message
Source:
Returns:
Type
boolean

isRAICandidate() → {Boolean}

Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)

Source:
Returns:
Type
Boolean

isRAICandidate() → {Boolean}

Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)

Source:
Returns:
Type
Boolean

(private) isSameUser(jid1, jid2) → {Boolean}

Given two JIDs, which can be either user JIDs or MUC occupant JIDs, determine whether they belong to the same user.

Parameters:
Name Type Description
jid1 String
jid2 String
Source:
Returns:
Type
Boolean

(private) isSameUser(jid1, jid2) → {Boolean}

Given two JIDs, which can be either user JIDs or MUC occupant JIDs, determine whether they belong to the same user.

Parameters:
Name Type Description
jid1 String
jid2 String
Source:
Returns:
Type
Boolean

(private) isUserMentioned()

Returns a boolean to indicate whether the current user was mentioned in a message.

Parameters:
Type Description
String

The text message

Source:

(private) isUserMentioned()

Returns a boolean to indicate whether the current user was mentioned in a message.

Parameters:
Type Description
String

The text message

Source:

(private) join(nick, passwordopt)

Join the MUC

Parameters:
Name Type Attributes Description
nick String

The user's nickname

password String <optional>

Optional password, if required by the groupchat. Will fall back to the password value stored in the room model (if available).

Source:

(private) join(nick, passwordopt)

Join the MUC

Parameters:
Name Type Attributes Description
nick String

The user's nickname

password String <optional>

Optional password, if required by the groupchat. Will fall back to the password value stored in the room model (if available).

Source:

(private) leave(exit_msgopt)

Leave the groupchat.

Parameters:
Name Type Attributes Description
exit_msg string <optional>

Message to indicate your reason for leaving

Source:

(private) leave(exit_msgopt)

Leave the groupchat.

Parameters:
Name Type Attributes Description
exit_msg string <optional>

Message to indicate your reason for leaving

Source:

(private) onDirectMUCInvitation(message)

A direct MUC invitation to join a groupchat has been received See XEP-0249: Direct MUC invitations.

Parameters:
Name Type Description
message Element

The message stanza containing the invitation.

Source:

(private) onDirectMUCInvitation(message)

A direct MUC invitation to join a groupchat has been received See XEP-0249: Direct MUC invitations.

Parameters:
Name Type Description
message Element

The message stanza containing the invitation.

Source:

(private) onHiddenChange()

Handler that gets called when the 'hidden' flag is toggled.

Source:

(private) onHiddenChange()

Handler that gets called when the 'hidden' flag is toggled.

Source:

onMessage(attrs)

Handler for all MUC messages sent to this groupchat. This method shouldn't be called directly, instead _converse.ChatRoom#queueMessage should be called.

Parameters:
Name Type Description
attrs MessageAttributes

A promise which resolves to the message attributes.

Source:

onMessage(attrs)

Handler for all MUC messages sent to this groupchat. This method shouldn't be called directly, instead _converse.ChatRoom#queueMessage should be called.

Parameters:
Name Type Description
attrs MessageAttributes

A promise which resolves to the message attributes.

Source:

(private) onOwnPresence(pres)

Handles a received presence relating to the current user.

For locked groupchats (which are by definition "new"), the groupchat will either be auto-configured or created instantly (with default config) or a configuration groupchat will be rendered.

If the groupchat is not locked, then the groupchat will be auto-configured only if applicable and if the current user is the groupchat's owner.

Parameters:
Name Type Description
pres Element

The stanza

Source:

(private) onOwnPresence(pres)

Handles a received presence relating to the current user.

For locked groupchats (which are by definition "new"), the groupchat will either be auto-configured or created instantly (with default config) or a configuration groupchat will be rendered.

If the groupchat is not locked, then the groupchat will be auto-configured only if applicable and if the current user is the groupchat's owner.

Parameters:
Name Type Description
pres Element

The stanza

Source:

(private) onPresence(stanza)

Handles incoming presence stanzas coming from the MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) onPresence(stanza)

Handles incoming presence stanzas coming from the MUC

Parameters:
Name Type Description
stanza Element
Source:

(private) onPresenceFromMUCHost(stanza)

Listens for incoming presence stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element

The presence stanza

Source:

(private) onPresenceFromMUCHost(stanza)

Listens for incoming presence stanzas from the service that hosts this MUC

Parameters:
Name Type Description
stanza Element

The presence stanza

Source:

(private) registerHandlers()

Register presence and message handlers relevant to this groupchat

Source:

(private) registerHandlers()

Register presence and message handlers relevant to this groupchat

Source:

(private) registerNickname()

Send an IQ stanza to the MUC to register this user's nickname. This sets the user's affiliation to 'member' (if they weren't affiliated before) and reserves the nickname for this user, thereby preventing other users from using it in this MUC. See https://xmpp.org/extensions/xep-0045.html#register

Source:

(private) registerNickname()

Send an IQ stanza to the MUC to register this user's nickname. This sets the user's affiliation to 'member' (if they weren't affiliated before) and reserves the nickname for this user, thereby preventing other users from using it in this MUC. See https://xmpp.org/extensions/xep-0045.html#register

Source:

(private) rejoin()

Clear stale cache and re-join a MUC we've been in before.

Source:

(private) rejoin()

Clear stale cache and re-join a MUC we've been in before.

Source:

rejoinIfNecessary()

Check whether we're still joined and re-join if not

Source:

rejoinIfNecessary()

Check whether we're still joined and re-join if not

Source:

(private) restoreFromCache() → {Boolean}

Checks whether we're still joined and if so, restores the MUC state from cache.

Source:
Returns:

Returns true if we're still joined, otherwise returns false.

Type
Boolean

(private) restoreFromCache() → {Boolean}

Checks whether we're still joined and if so, restores the MUC state from cache.

Source:
Returns:

Returns true if we're still joined, otherwise returns false.

Type
Boolean

(private) retractOtherMessage(message, reasonopt)

Retract someone else's message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:
Example
const room = await api.rooms.get(jid);
 const message = room.messages.findWhere({'body': 'Get rich quick!'});
 room.retractOtherMessage(message, 'spam');

(private) retractOtherMessage(message, reasonopt)

Retract someone else's message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:
Example
const room = await api.rooms.get(jid);
 const message = room.messages.findWhere({'body': 'Get rich quick!'});
 room.retractOtherMessage(message, 'spam');

(private) retractOwnMessage(message)

Retract one of your messages in this groupchat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) retractOwnMessage(message)

Retract one of your messages in this groupchat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) sendChatState()

Sends a message with the current XEP-0085 chat state of the user as taken from the chat_state attribute of the _converse.ChatRoom.

Source:

(private) sendChatState()

Sends a message with the current XEP-0085 chat state of the user as taken from the chat_state attribute of the _converse.ChatRoom.

Source:

(private) sendConfiguration(config) → {Promise.<Element>}

Sends an IQ stanza with the groupchat configuration.

Parameters:
Name Type Description
config Array

The groupchat configuration

Source:
Returns:
  • A promise which resolves with the result stanza received from the XMPP server.
Type
Promise.<Element>

(private) sendConfiguration(config) → {Promise.<Element>}

Sends an IQ stanza with the groupchat configuration.

Parameters:
Name Type Description
config Array

The groupchat configuration

Source:
Returns:
  • A promise which resolves with the result stanza received from the XMPP server.
Type
Promise.<Element>

(private) sendDestroyIQ(reasonopt, new_jidopt)

Sends an IQ stanza to the XMPP server to destroy this groupchat. Not to be confused with the _converse.ChatRoom#destroy method, which simply removes the room from the local browser storage cache.

Parameters:
Name Type Attributes Description
reason string <optional>

The reason for destroying the groupchat.

new_jid string <optional>

The JID of the new groupchat which replaces this one.

Source:

(private) sendDestroyIQ(reasonopt, new_jidopt)

Sends an IQ stanza to the XMPP server to destroy this groupchat. Not to be confused with the _converse.ChatRoom#destroy method, which simply removes the room from the local browser storage cache.

Parameters:
Name Type Attributes Description
reason string <optional>

The reason for destroying the groupchat.

new_jid string <optional>

The JID of the new groupchat which replaces this one.

Source:

(private) sendRetractionIQ(message, reasonopt)

Sends an IQ stanza to the XMPP server to retract a message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:

(private) sendRetractionIQ(message, reasonopt)

Sends an IQ stanza to the XMPP server to retract a message in this groupchat.

Parameters:
Name Type Attributes Description
message _converse.ChatRoomMessage

The message which we're retracting.

reason string <optional>

The reason for retracting the message.

Source:

sendStatusPresence(type, statusopt, child_nodesopt)

Sends a status update presence (i.e. based on the <show> element)

Parameters:
Name Type Attributes Description
type String
status String <optional>

An optional status message

child_nodes Array.<Element> | Array.<Strophe.Builder> | Element | Strophe.Builder <optional>

Nodes(s) to be added as child nodes of the presence XML element.

Source:

sendStatusPresence(type, statusopt, child_nodesopt)

Sends a status update presence (i.e. based on the <show> element)

Parameters:
Name Type Attributes Description
type String
status String <optional>

An optional status message

child_nodes Array.<Element> | Array.<Strophe.Builder> | Element | Strophe.Builder <optional>

Nodes(s) to be added as child nodes of the presence XML element.

Source:

(private) sendTimedMessage(message) → {Promise.<Element>|Promise.<TimeoutError>}

Sends a message stanza to the XMPP server and expects a reflection or error message within a specific timeout period.

Parameters:
Name Type Description
message _converse.Message | Element
Source:
Returns:

Returns a promise which resolves with the reflected message stanza or with an error stanza or TimeoutError.

Type
Promise.<Element> | Promise.<TimeoutError>

(private) sendTimedMessage(message) → {Promise.<Element>|Promise.<TimeoutError>}

Sends a message stanza to the XMPP server and expects a reflection or error message within a specific timeout period.

Parameters:
Name Type Description
message _converse.Message | Element
Source:
Returns:

Returns a promise which resolves with the reflected message stanza or with an error stanza or TimeoutError.

Type
Promise.<Element> | Promise.<TimeoutError>

sendUnregistrationIQ()

Send an IQ stanza to the MUC to unregister this user's nickname. 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.

Source:

sendUnregistrationIQ()

Send an IQ stanza to the MUC to unregister this user's nickname. 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.

Source:

(private) setRole(occupant, role, reason, onSuccess, onError)

Send an IQ stanza to modify an occupant's role

Parameters:
Name Type Description
occupant _converse.ChatRoomOccupant
role String
reason String
onSuccess function

callback for a succesful response

onError function

callback for an error response

Source:

(private) setRole(occupant, role, reason, onSuccess, onError)

Send an IQ stanza to modify an occupant's role

Parameters:
Name Type Description
occupant _converse.ChatRoomOccupant
role String
reason String
onSuccess function

callback for a succesful response

onError function

callback for an error response

Source:

(private) setSubject(value)

Set the subject for this _converse.ChatRoom

Parameters:
Name Type Description
value String
Source:

(private) setSubject(value)

Set the subject for this _converse.ChatRoom

Parameters:
Name Type Description
value String
Source:

(private) shouldShowErrorMessage() → {Promise.<boolean>}

Source:
Returns:
Type
Promise.<boolean>

(private) shouldShowErrorMessage() → {Promise.<boolean>}

Source:
Returns:
Type
Promise.<boolean>

unregisterNickname()

Check whether we should unregister the user from this MUC, and if so, call { @link _converse.ChatRoom#sendUnregistrationIQ }

Source:

unregisterNickname()

Check whether we should unregister the user from this MUC, and if so, call { @link _converse.ChatRoom#sendUnregistrationIQ }

Source:

(private) updateMemberLists(members) → {Promise}

Fetch the lists of users with the given affiliations. Then compute the delta between those users and the passed in members, and if it exists, send the delta to the XMPP server to update the member list.

Parameters:
Name Type Description
members object

Map of member jids and affiliations.

Source:
Returns:

A promise which is resolved once the list has been updated or once it's been established there's no need to update the list.

Type
Promise

(private) updateMemberLists(members) → {Promise}

Fetch the lists of users with the given affiliations. Then compute the delta between those users and the passed in members, and if it exists, send the delta to the XMPP server to update the member list.

Parameters:
Name Type Description
members object

Map of member jids and affiliations.

Source:
Returns:

A promise which is resolved once the list has been updated or once it's been established there's no need to update the list.

Type
Promise

(private) updateOccupantsOnPresence(pres)

Given a presence stanza, update the occupant model based on its contents.

Parameters:
Name Type Description
pres Element

The presence stanza

Source:

(private) updateOccupantsOnPresence(pres)

Given a presence stanza, update the occupant model based on its contents.

Parameters:
Name Type Description
pres Element

The presence stanza

Source: