Commit e8eea632 authored by JC Brand's avatar JC Brand

MUC: Send XEP-0333 markers with the MUC stanza id

See: https://xmpp.org/extensions/xep-0333.html#rules-muc
parent c4570815
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
- File structure reordering: All plugins are now in `./plugins` folders. - File structure reordering: All plugins are now in `./plugins` folders.
- New configuration setting: [show_tab_notifications](https://conversejs.org/docs/html/configuration.html#show-tab-notifications) - New configuration setting: [show_tab_notifications](https://conversejs.org/docs/html/configuration.html#show-tab-notifications)
- New configuration setting: [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave) - New configuration setting: [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave)
- Use the MUC stanza id when sending XEP-0333 markers
### Breaking Changes ### Breaking Changes
......
...@@ -178,6 +178,26 @@ const ChatRoomMixin = { ...@@ -178,6 +178,26 @@ const ChatRoomMixin = {
} }
}, },
/**
* Given the passed in MUC message, send a XEP-0333 chat marker.
* @param { _converse.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.
*/
sendMarkerForMessage (msg, type='displayed', force=false) {
if (!msg) return;
if (msg?.get('is_markable') || force) {
const id = msg.get(`stanza_id ${this.get('jid')}`);
if (!id) {
log.error(`Can't send marker for message without stanza ID: ${msg}`);
return;
}
const from_jid = Strophe.getBareJidFromJid(msg.get('from'));
this.sendMarker(from_jid, id, type, msg.get('type'));
}
},
/** /**
* Handler that gets called when the 'hidden' flag is toggled. * Handler that gets called when the 'hidden' flag is toggled.
* @private * @private
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment