Enable sending of MUC presence probes

This commit is contained in:
JC Brand 2020-05-05 15:32:15 +02:00
parent 2e82b82d7f
commit d49b630bdc
3 changed files with 30 additions and 2 deletions

View File

@ -33,10 +33,11 @@ Soon we'll deprecate the latter, so prepare now.
[discover_connection_methods](https://conversejs.org/docs/html/configuration.html#discover-connection-methods) now has a default value of `true`).
- [show_send_button](https://conversejs.org/docs/html/configuration.html#show-send-button) now has a default value of `true`.
- The [api.confirm](https://conversejs.org/docs/html/api/-_converse.api.html#.confirm) method now accepts a list of fields and returns the filled in list upon confirmation.
- New config option [allow_adhoc_commands](https://conversejs.org/docs/html/configuration.html#allow-adhoc-commands)
- New config option [modtools_disable_assign](https://conversejs.org/docs/html/configuration.html#modtools-disable-assign)
- New config option [modtools_disable_query](https://conversejs.org/docs/html/configuration.html#modtools-disable-query)
- New config option [allow_adhoc_commands](https://conversejs.org/docs/html/configuration.html#allow-adhoc-commands)
- New config option [muc_hats_from_vcard](https://conversejs.org/docs/html/configuration.html#muc-hats-from-vcard).
- New config option [muc_send_probes](https://conversejs.org/docs/html/configuration.html#muc-send-probes).
## 6.0.0 (2020-01-09)

View File

@ -1181,6 +1181,25 @@ automatically be "john". If now john@differentdomain.com tries to join the
room, his nickname will be "john-2", and if john@somethingelse.com joins, then
his nickname will be "john-3", and so forth.
muc_send_probes
---------------
* Default: ``false``
If set to ``true``, then whenever Converse receives a MUC message with an author for which we don't have
any information (i.e. because that user is currently not in the MUC), then Converse will send out a ``<presence>``
stanza of type ``probe`` in order to request the authors presence data.
Note, although this behavior is described in the `presence business rules of XEP-0045, section 17.3 point 4 <https://xmpp.org/extensions/xep-0045.html#bizrules-presence>`_,
few XMPP servers support this.
Prosody has some experimental support in it's contrib branch (hopefully soon to
be merged to trunk).
The point of sending out presence probes is in order to receive
presence-related metadata, such as `XEP-0317 Hats <https://xmpp.org/extensions/xep-0317.html>`_.
muc_respect_autojoin
--------------------

View File

@ -125,6 +125,7 @@ converse.plugins.add('converse-muc', {
'muc_history_max_stanzas': undefined,
'muc_instant_rooms': true,
'muc_nickname_from_jid': false,
'muc_send_probes': false,
'muc_show_join_leave': true,
'muc_show_logs_before_join': false
});
@ -305,7 +306,14 @@ converse.plugins.add('converse-muc', {
return log.error(`Could not get collection.chatbox for message: ${JSON.stringify(this.toJSON())}`);
}
const nick = Strophe.getResourceFromJid(this.get('from'));
this.occupant = chatbox.occupants.findWhere({'nick': nick});
this.occupant = chatbox.occupants.findWhere({ nick });
if (!this.occupant && api.settings.get("muc_send_probes")) {
this.occupant = chatbox.occupants.create({ nick, 'type': 'unavailable' });
const jid = `${chatbox.get('jid')}/${nick}`;
api.user.presence.send('probe', jid);
}
if (this.occupant) {
this.listenTo(this.occupant, 'destroy', this.onOccupantRemoved);
} else {