3
votes

I'm working on persistent group conversations with Ejabberd 19.09 and mucsub.

When a member of a group sends a presence unavailable, sometimes the server does not respond at all. If we repeat the same test after sending a presence available just before the presence unavailable, the server responds. In any case, apparently, we have no changes in the room occupancy.

Is this an expected behavior?

First test:

Steps to reproduce first test:

  1. admin test1 creates a room roomX (members-only)
    <!-- [CREATE ROOM] | test1 -->
    <iq from='[email protected]' to='[email protected]' type='set' id='1111111'>
      <subscribe xmlns='urn:xmpp:mucsub:0' nick='test1'>
        <event node='urn:xmpp:mucsub:nodes:messages' /><event node='urn:xmpp:mucsub:nodes:affiliations' /><event node='urn:xmpp:mucsub:nodes:subject' /><event node='urn:xmpp:mucsub:nodes:config' /><event node='urn:xmpp:mucsub:nodes:subscribers' /><event node='urn:xmpp:mucsub:nodes:presence' />
      </subscribe>
    </iq>
  1. admin test1 invites and subscribes the user test2
<!-- [INVITE test2] | test1 -->
<message from='[email protected]' id='33333' to='[email protected]'>
  <x xmlns='http://jabber.org/protocol/muc#user'>
    <invite to='[email protected]'><reason>REASON</reason></invite>
  </x>
</message>
<!-- [SUBSCRIBE test2 TO ROOM] | test1 -->
<iq from='[email protected]' to='[email protected]' type='set' id='222222'>
  <subscribe xmlns='urn:xmpp:mucsub:0' jid='[email protected]' nick='test2'>
    <event node='urn:xmpp:mucsub:nodes:messages' /><event node='urn:xmpp:mucsub:nodes:presence' /><event node='urn:xmpp:mucsub:nodes:subject' /><event node='urn:xmpp:mucsub:nodes:config' /><event node='urn:xmpp:mucsub:nodes:subscribers' /><event node='urn:xmpp:mucsub:nodes:presence' />
  </subscribe>
</iq>
  1. the invitation is automatically accepted, user test2 is now a room member, he can send messages and he is subscribed to all events
  2. member test2 wants to abandon the room, and sends a presence type=unavailable
<!-- [test2 leaves the room] | test2 -->
<presence to='[email protected]/test2' from='[email protected]' type='unavailable'>
  <status>leave</status>
</presence>

Results:

  • service does not respond to member
  • no changes to the room occupancy: member’s affiliation is still “member”, role is still “member”, subscription is still active

Second test:

Steps to reproduce second test:

  1. admin test1 creates a room roomX (members-only)
  2. admin test1 invites and subscribes the user test2
  3. the invitation is automatically accepted, user test2 is now a room member, he can send messages and he is subscribed to all events
  4. member test2 sends a presence type=available (in theory this is redundant, but it's made on purpose as part of this test)
<!-- [test2 JOINS THE ROOM] | test2 -->
<presence from='[email protected]' id='n13mt3l' to='[email protected]/test2'>
  <x xmlns='http://jabber.org/protocol/muc'/>
</presence>
  1. member test2 wants to abandon the room, and sends a presence type=unavailable

Results

  • service responds to member
  • no changes to the room occupancy: member’s affiliation is still “member”, role is still “member”, subscription is still active
2

2 Answers

0
votes

First test: Steps: admin invites a member member

I guess using https://xmpp.org/extensions/xep-0045.html#invite-mediated

sends a presence unavailable

Why that? It should be a message, not a presence:

The invitee MAY choose to formally decline (as opposed to ignore) the invitation; and this is something that the sender might want to be informed about. In order to decline the invitation, the invitee MUST send a message of the following form to the itself:

0
votes

I think you are missing the first step which is :

<presence to='[email protected]/test1'  id='s6MLD-390'><x xmlns='http://jabber.org/protocol/muc'></x></presence>