|
@@ -9,7 +9,7 @@ import { Model } from 'skeletor.js/src/model.js';
|
|
import converse from "./converse-core";
|
|
import converse from "./converse-core";
|
|
import filesize from "filesize";
|
|
import filesize from "filesize";
|
|
import log from "./log";
|
|
import log from "./log";
|
|
-import stanza_utils from "./utils/stanza";
|
|
|
|
|
|
+import st from "./utils/stanza";
|
|
|
|
|
|
const { $msg, Strophe, sizzle, utils } = converse.env;
|
|
const { $msg, Strophe, sizzle, utils } = converse.env;
|
|
const u = converse.env.utils;
|
|
const u = converse.env.utils;
|
|
@@ -411,7 +411,7 @@ converse.plugins.add('converse-chat', {
|
|
},
|
|
},
|
|
|
|
|
|
async onMessage (stanza, original_stanza, from_jid) {
|
|
async onMessage (stanza, original_stanza, from_jid) {
|
|
- const attrs = await this.getMessageAttributesFromStanza(stanza, original_stanza);
|
|
|
|
|
|
+ const attrs = await this.parseMessage(stanza, original_stanza);
|
|
const message = this.getDuplicateMessage(attrs);
|
|
const message = this.getDuplicateMessage(attrs);
|
|
if (message) {
|
|
if (message) {
|
|
this.updateMessage(message, original_stanza);
|
|
this.updateMessage(message, original_stanza);
|
|
@@ -527,7 +527,7 @@ converse.plugins.add('converse-chat', {
|
|
|
|
|
|
getUpdatedMessageAttributes (message, stanza) { // eslint-disable-line no-unused-vars
|
|
getUpdatedMessageAttributes (message, stanza) { // eslint-disable-line no-unused-vars
|
|
return {
|
|
return {
|
|
- 'is_archived': stanza_utils.isArchived(stanza),
|
|
|
|
|
|
+ 'is_archived': st.isArchived(stanza),
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -610,7 +610,7 @@ converse.plugins.add('converse-chat', {
|
|
* @private
|
|
* @private
|
|
* @method _converse.ChatBox#findDanglingRetraction
|
|
* @method _converse.ChatBox#findDanglingRetraction
|
|
* @param { object } attrs - Attributes representing a received
|
|
* @param { object } attrs - Attributes representing a received
|
|
- * message, as returned by {@link stanza_utils.getMessageAttributesFromStanza}
|
|
|
|
|
|
+ * message, as returned by {@link st.parseMessage}
|
|
* @returns { _converse.Message }
|
|
* @returns { _converse.Message }
|
|
*/
|
|
*/
|
|
findDanglingRetraction (attrs) {
|
|
findDanglingRetraction (attrs) {
|
|
@@ -637,7 +637,7 @@ converse.plugins.add('converse-chat', {
|
|
* @private
|
|
* @private
|
|
* @method _converse.ChatBox#handleRetraction
|
|
* @method _converse.ChatBox#handleRetraction
|
|
* @param { object } attrs - Attributes representing a received
|
|
* @param { object } attrs - Attributes representing a received
|
|
- * message, as returned by {@link stanza_utils.getMessageAttributesFromStanza}
|
|
|
|
|
|
+ * message, as returned by {@link st.parseMessage}
|
|
* @returns { Boolean } Returns `true` or `false` depending on
|
|
* @returns { Boolean } Returns `true` or `false` depending on
|
|
* whether a message was retracted or not.
|
|
* whether a message was retracted or not.
|
|
*/
|
|
*/
|
|
@@ -677,7 +677,7 @@ converse.plugins.add('converse-chat', {
|
|
* @private
|
|
* @private
|
|
* @method _converse.ChatBox#handleCorrection
|
|
* @method _converse.ChatBox#handleCorrection
|
|
* @param { object } attrs - Attributes representing a received
|
|
* @param { object } attrs - Attributes representing a received
|
|
- * message, as returned by {@link stanza_utils.getMessageAttributesFromStanza}
|
|
|
|
|
|
+ * message, as returned by {@link st.parseMessage}
|
|
* @returns { _converse.Message|undefined } Returns the corrected
|
|
* @returns { _converse.Message|undefined } Returns the corrected
|
|
* message or `undefined` if not applicable.
|
|
* message or `undefined` if not applicable.
|
|
*/
|
|
*/
|
|
@@ -710,7 +710,7 @@ converse.plugins.add('converse-chat', {
|
|
* @private
|
|
* @private
|
|
* @method _converse.ChatBox#getDuplicateMessage
|
|
* @method _converse.ChatBox#getDuplicateMessage
|
|
* @param { object } attrs - Attributes representing a received
|
|
* @param { object } attrs - Attributes representing a received
|
|
- * message, as returned by {@link stanza_utils.getMessageAttributesFromStanza}
|
|
|
|
|
|
+ * message, as returned by {@link st.parseMessage}
|
|
* @returns {Promise<_converse.Message>}
|
|
* @returns {Promise<_converse.Message>}
|
|
*/
|
|
*/
|
|
getDuplicateMessage (attrs) {
|
|
getDuplicateMessage (attrs) {
|
|
@@ -1084,17 +1084,17 @@ converse.plugins.add('converse-chat', {
|
|
/**
|
|
/**
|
|
* Parses a passed in message stanza and returns an object of attributes.
|
|
* Parses a passed in message stanza and returns an object of attributes.
|
|
* @private
|
|
* @private
|
|
- * @method _converse.ChatBox#getMessageAttributesFromStanza
|
|
|
|
|
|
+ * @method _converse.ChatBox#parseMessage
|
|
* @param { XMLElement } stanza - The message stanza
|
|
* @param { XMLElement } stanza - The message stanza
|
|
* @param { XMLElement } original_stanza - The original stanza, that contains the
|
|
* @param { XMLElement } original_stanza - The original stanza, that contains the
|
|
* message stanza, if it was contained, otherwise it's the message stanza itself.
|
|
* message stanza, if it was contained, otherwise it's the message stanza itself.
|
|
* @returns { Object }
|
|
* @returns { Object }
|
|
*/
|
|
*/
|
|
- getMessageAttributesFromStanza (stanza, original_stanza) {
|
|
|
|
|
|
+ parseMessage (stanza, original_stanza) {
|
|
// XXX: Eventually we want to get rid of this pass-through
|
|
// XXX: Eventually we want to get rid of this pass-through
|
|
// method but currently we still need it because converse-omemo
|
|
// method but currently we still need it because converse-omemo
|
|
// overrides it.
|
|
// overrides it.
|
|
- return stanza_utils.getMessageAttributesFromStanza(stanza, original_stanza, this, _converse);
|
|
|
|
|
|
+ return st.parseMessage(stanza, original_stanza, this, _converse);
|
|
},
|
|
},
|
|
|
|
|
|
maybeShow () {
|
|
maybeShow () {
|
|
@@ -1169,7 +1169,7 @@ converse.plugins.add('converse-chat', {
|
|
if (!should_show) {
|
|
if (!should_show) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const attrs = await chatbox.getMessageAttributesFromStanza(stanza, stanza);
|
|
|
|
|
|
+ const attrs = await chatbox.parseMessage(stanza, stanza);
|
|
await chatbox.createMessage(attrs);
|
|
await chatbox.createMessage(attrs);
|
|
}
|
|
}
|
|
|
|
|