xmppejabberdmultiuserchat

Determine online JIDs of participants in an XMPP MUC room


When joining an XMPP MUC room, a presence stanza is sent to participants. That's also true when a user joins a second time with the same JID and nick, but a different resource. However, when leaving a MUC room an unavailable presence stanza is only sent to participants, when the last resource of a user leaves the MUC room.

Example:

john@example.tld/A with nick "john" joins => presence is sent to participants
john@example.tld/B with nick "john" joins => presence is sent to participants
john@example.tld/A leaves                 => nothing is sent to participants
john@example.tld/B leaves                 => presence is sent to participants

Is there a way as a participant to get presence stanzas for all resource leaving the MUC room to be able to track which JIDs are online with which resources?


Solution

  • XEP-0045 does not handle the case of two user sessions joining the same room with the same nick, that was added by ejabberd. And it was implemented in a way that respects XEP-0045, and doesn't break existing clients.

    You propose that when one of those sessions exit the room, ejabberd should send https://xmpp.org/extensions/xep-0045.html#example-82

    Have you considered that this would confuse the other room participants clients? Such clients implement XEP-0045, are not aware that there may be several sessions with different resources... and will consider that the exit-stanza you propose means the user has left the room completely.

    Is there a way as a participant to get presence stanzas for all resource leaving the MUC room to be able to track which JIDs are online with which resources?

    No, I didn't find any method.