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

See: https://xmpp.org/extensions/xep-0333.html#rules-muc
This commit is contained in:
JC Brand 2020-12-14 14:38:39 +01:00
parent c457081597
commit e8eea6324e
2 changed files with 21 additions and 0 deletions

View File

@ -10,6 +10,7 @@
- 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: [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

View File

@ -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.
* @private