Converse converse.js

Namespace: ChatBox

_converse.ChatBox

Represents an open/ongoing chat conversation.

Source:

Methods

(async, private) createMessage(attrs)

Queue the creation of a message, to make sure that we don't run into a race condition whereby we're creating a new message before the collection has been fetched.

Parameters:
Name Type Description
attrs Object
Source:

(async, private) createMessage(attrs)

Queue the creation of a message, to make sure that we don't run into a race condition whereby we're creating a new message before the collection has been fetched.

Parameters:
Name Type Description
attrs Object
Source:

(private) createMessageStanza(message)

Given a _converse.Message return the XML stanza that represents it.

Parameters:
Name Type Description
message _converse.Message

The message object

Source:

(private) createMessageStanza(message)

Given a _converse.Message return the XML stanza that represents it.

Parameters:
Name Type Description
message _converse.Message

The message object

Source:

(private) findDanglingRetraction(attrs) → {_converse.Message}

Looks whether we already have a retraction 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 parseMessage

Source:
Returns:
Type
_converse.Message

(private) findDanglingRetraction(attrs) → {_converse.Message}

Looks whether we already have a retraction 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 parseMessage

Source:
Returns:
Type
_converse.Message

(private) 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 parseMessage

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

(private) 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 parseMessage

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

(private) handleCorrection(attrs) → {_converse.Message|undefined}

Determines whether the passed in message attributes represent a message which corrects a previously received message, or an older message which has already been corrected. In both cases, update the corrected message accordingly.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

Returns the corrected message or undefined if not applicable.

Type
_converse.Message | undefined

(private) handleCorrection(attrs) → {_converse.Message|undefined}

Determines whether the passed in message attributes represent a message which corrects a previously received message, or an older message which has already been corrected. In both cases, update the corrected message accordingly.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

Returns the corrected message or undefined if not applicable.

Type
_converse.Message | undefined

(private) handleRetraction(attrs) → {Boolean}

Handles message retraction based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

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

Type
Boolean

(private) handleRetraction(attrs) → {Boolean}

Handles message retraction based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

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

Type
Boolean

(private) handleUnreadMessage(message)

Given a newly received _converse.Message instance, update the unread counter if necessary.

Parameters:
Name Type Description
message _converse.Message
Source:

(private) handleUnreadMessage(message)

Given a newly received _converse.Message instance, update the unread counter if necessary.

Parameters:
Name Type Description
message _converse.Message
Source:

(async, private) onMessage(attrs_promse)

Parameters:
Name Type Description
attrs_promse MessageAttributes

A promise which resolves to the message attributes.

Source:

(async, private) onMessage(attrs_promse)

Parameters:
Name Type Description
attrs_promse MessageAttributes

A promise which resolves to the message attributes.

Source:

(async, private) queueMessage(attrs)

Queue an incoming chat message stanza for processing.

Parameters:
Name Type Description
attrs Promise.<MessageAttributes>

A promise which resolves to the message attributes

Source:

(async, private) queueMessage(attrs)

Queue an incoming chat message stanza for processing.

Parameters:
Name Type Description
attrs Promise.<MessageAttributes>

A promise which resolves to the message attributes

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.ChatBox.

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.ChatBox.

Source:

(private) sendMessage(attrsopt) → {_converse.Message}

Responsible for sending off a text message inside an ongoing chat conversation.

Parameters:
Name Type Attributes Description
attrs Object <optional>

A map of attributes to be saved on the message

Source:
Returns:
Type
_converse.Message
Example
const chat = api.chats.get('buddy1@example.org');
chat.sendMessage({'body': 'hello world'});

(private) sendMessage(attrsopt) → {_converse.Message}

Responsible for sending off a text message inside an ongoing chat conversation.

Parameters:
Name Type Attributes Description
attrs Object <optional>

A map of attributes to be saved on the message

Source:
Returns:
Type
_converse.Message
Example
const chat = api.chats.get('buddy1@example.org');
chat.sendMessage({'body': 'hello world'});

(private) sendRetractionMessage(message)

Sends a message stanza to retract a message in this chat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) sendRetractionMessage(message)

Sends a message stanza to retract a message in this chat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) setChatState(state)

Mutator for setting the chat state of this chat session. Handles clearing of any chat state notification timeouts and setting new ones if necessary. Timeouts are set when the state being set is COMPOSING or PAUSED. After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE. See XEP-0085 Chat State Notifications.

Parameters:
Name Type Description
state string

The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)

Source:

(private) setChatState(state)

Mutator for setting the chat state of this chat session. Handles clearing of any chat state notification timeouts and setting new ones if necessary. Timeouts are set when the state being set is COMPOSING or PAUSED. After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE. See XEP-0085 Chat State Notifications.

Parameters:
Name Type Description
state string

The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)

Source:

setEditable(attrs, send_time)

Responsible for setting the editable attribute of messages. If api.settings.get('allow_message_corrections') is "last", then only the last message sent from me will be editable. If set to "all" all messages will be editable. Otherwise no messages will be editable.

Parameters:
Name Type Description
attrs Object

An object containing message attributes.

send_time String

time when the message was sent

Source:

setEditable(attrs, send_time)

Responsible for setting the editable attribute of messages. If api.settings.get('allow_message_corrections') is "last", then only the last message sent from me will be editable. If set to "all" all messages will be editable. Otherwise no messages will be editable.

Parameters:
Name Type Description
attrs Object

An object containing message attributes.

send_time String

time when the message was sent

Source:

(private) shouldShowErrorMessage() → {boolean}

Source:
Returns:
Type
boolean

(private) shouldShowErrorMessage() → {boolean}

Source:
Returns:
Type
boolean

_converse.ChatBox

Represents an open/ongoing chat conversation.

Source:

Methods

(async, private) createMessage(attrs)

Queue the creation of a message, to make sure that we don't run into a race condition whereby we're creating a new message before the collection has been fetched.

Parameters:
Name Type Description
attrs Object
Source:

(async, private) createMessage(attrs)

Queue the creation of a message, to make sure that we don't run into a race condition whereby we're creating a new message before the collection has been fetched.

Parameters:
Name Type Description
attrs Object
Source:

(private) createMessageStanza(message)

Given a _converse.Message return the XML stanza that represents it.

Parameters:
Name Type Description
message _converse.Message

The message object

Source:

(private) createMessageStanza(message)

Given a _converse.Message return the XML stanza that represents it.

Parameters:
Name Type Description
message _converse.Message

The message object

Source:

(private) findDanglingRetraction(attrs) → {_converse.Message}

Looks whether we already have a retraction 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 parseMessage

Source:
Returns:
Type
_converse.Message

(private) findDanglingRetraction(attrs) → {_converse.Message}

Looks whether we already have a retraction 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 parseMessage

Source:
Returns:
Type
_converse.Message

(private) 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 parseMessage

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

(private) 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 parseMessage

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

(private) handleCorrection(attrs) → {_converse.Message|undefined}

Determines whether the passed in message attributes represent a message which corrects a previously received message, or an older message which has already been corrected. In both cases, update the corrected message accordingly.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

Returns the corrected message or undefined if not applicable.

Type
_converse.Message | undefined

(private) handleCorrection(attrs) → {_converse.Message|undefined}

Determines whether the passed in message attributes represent a message which corrects a previously received message, or an older message which has already been corrected. In both cases, update the corrected message accordingly.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

Returns the corrected message or undefined if not applicable.

Type
_converse.Message | undefined

(private) handleRetraction(attrs) → {Boolean}

Handles message retraction based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

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

Type
Boolean

(private) handleRetraction(attrs) → {Boolean}

Handles message retraction based on the passed in attributes.

Parameters:
Name Type Description
attrs object

Attributes representing a received message, as returned by parseMessage

Source:
Returns:

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

Type
Boolean

(private) handleUnreadMessage(message)

Given a newly received _converse.Message instance, update the unread counter if necessary.

Parameters:
Name Type Description
message _converse.Message
Source:

(private) handleUnreadMessage(message)

Given a newly received _converse.Message instance, update the unread counter if necessary.

Parameters:
Name Type Description
message _converse.Message
Source:

(async, private) onMessage(attrs_promse)

Parameters:
Name Type Description
attrs_promse MessageAttributes

A promise which resolves to the message attributes.

Source:

(async, private) onMessage(attrs_promse)

Parameters:
Name Type Description
attrs_promse MessageAttributes

A promise which resolves to the message attributes.

Source:

(async, private) queueMessage(attrs)

Queue an incoming chat message stanza for processing.

Parameters:
Name Type Description
attrs Promise.<MessageAttributes>

A promise which resolves to the message attributes

Source:

(async, private) queueMessage(attrs)

Queue an incoming chat message stanza for processing.

Parameters:
Name Type Description
attrs Promise.<MessageAttributes>

A promise which resolves to the message attributes

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.ChatBox.

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.ChatBox.

Source:

(private) sendMessage(attrsopt) → {_converse.Message}

Responsible for sending off a text message inside an ongoing chat conversation.

Parameters:
Name Type Attributes Description
attrs Object <optional>

A map of attributes to be saved on the message

Source:
Returns:
Type
_converse.Message
Example
const chat = api.chats.get('buddy1@example.org');
chat.sendMessage({'body': 'hello world'});

(private) sendMessage(attrsopt) → {_converse.Message}

Responsible for sending off a text message inside an ongoing chat conversation.

Parameters:
Name Type Attributes Description
attrs Object <optional>

A map of attributes to be saved on the message

Source:
Returns:
Type
_converse.Message
Example
const chat = api.chats.get('buddy1@example.org');
chat.sendMessage({'body': 'hello world'});

(private) sendRetractionMessage(message)

Sends a message stanza to retract a message in this chat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) sendRetractionMessage(message)

Sends a message stanza to retract a message in this chat

Parameters:
Name Type Description
message _converse.Message

The message which we're retracting.

Source:

(private) setChatState(state)

Mutator for setting the chat state of this chat session. Handles clearing of any chat state notification timeouts and setting new ones if necessary. Timeouts are set when the state being set is COMPOSING or PAUSED. After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE. See XEP-0085 Chat State Notifications.

Parameters:
Name Type Description
state string

The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)

Source:

(private) setChatState(state)

Mutator for setting the chat state of this chat session. Handles clearing of any chat state notification timeouts and setting new ones if necessary. Timeouts are set when the state being set is COMPOSING or PAUSED. After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE. See XEP-0085 Chat State Notifications.

Parameters:
Name Type Description
state string

The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)

Source:

setEditable(attrs, send_time)

Responsible for setting the editable attribute of messages. If api.settings.get('allow_message_corrections') is "last", then only the last message sent from me will be editable. If set to "all" all messages will be editable. Otherwise no messages will be editable.

Parameters:
Name Type Description
attrs Object

An object containing message attributes.

send_time String

time when the message was sent

Source:

setEditable(attrs, send_time)

Responsible for setting the editable attribute of messages. If api.settings.get('allow_message_corrections') is "last", then only the last message sent from me will be editable. If set to "all" all messages will be editable. Otherwise no messages will be editable.

Parameters:
Name Type Description
attrs Object

An object containing message attributes.

send_time String

time when the message was sent

Source:

(private) shouldShowErrorMessage() → {boolean}

Source:
Returns:
Type
boolean

(private) shouldShowErrorMessage() → {boolean}

Source:
Returns:
Type
boolean