Represents an open/ongoing chat conversation.
- Source:
Methods
(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 st.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 st.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 st.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 st.parseMessage |
- Source:
Returns:
Returns true
or false
depending on
whether a message was retracted or not.
- Type
- Boolean
(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(text, spoiler_hint) → {_converse.Message}
Responsible for sending off a text message inside an ongoing chat conversation.
Parameters:
Name | Type | Description |
---|---|---|
text |
String | The chat message text |
spoiler_hint |
String | An optional hint, if the message being sent is a spoiler |
- Source:
Returns:
- Type
- _converse.Message
Example
const chat = api.chats.get('buddy1@example.com');
chat.sendMessage('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) 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:
(private) shouldShowErrorMessage() → {boolean}
- Source:
Returns:
- Type
- boolean