0
votes

We're implementing an xmpp client and we are using ejabberd as xmpp server. We've implemented muc (multi user chat) functionalities to our app and everything is working fine , only thing we are having problem is a member to leave the group permanently.

I know in XEP 45 says if you want to leave the group just send the unavailable presence to room but this doesnt work in our case because our admins add users of the group to memberList by sending the below xml:

<iq from='[email protected]/desktop'
    id='member1'
    to='[email protected]'
    type='set'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
    <item affiliation='member'
          jid='[email protected]'
          nick='thirdwitch'/>
  </query>
</iq>

And when a member send unavailable presence, this doesnt affect the groups member list(Which is working as we wanted) So we want to find a way for a member to remove himself/herself from group members list permanently so he/she wont be able to receive any messages from that group anymore Is something like that possible? Can we remove ourself from groups member's list like whatsapp's leave chat functionality.

2

2 Answers

0
votes

When user leaves room he will not receive messages anymore - XMPP MUCs are presence-based. "Member lists" are only for administrative purposes and does not control message receiving.

There are some another XMPP extension specifications designed with "persistent" member list in mind, for example MUC Light - it can be more suited for you needs.

0
votes

As defined in XEP-0045, if the MUC admin added another user as member, that added user cannot remove himself as member. However, as a default in XEP-0045, MUC members do not receive message. This brings me to think this is not the problem you are hitting.

I suggest that you use MUC/Sub as implemented in ejabberd and defined in this specification for more flexibility. It is 100% compliant with MUC specification, so MUC compliant client and MUC/Sub enhanced client can participate in the same workflow.

In your case, I think that you need to subscribe your users to the events he wants (message, possibly presence or configuration changes). Subscription can be handled by users so that user can also control unsubscribe. It should do exactly what you want.

You need ejabberd 16.09 to use that specification. MUC/Sub is defined here: https://docs.ejabberd.im/developer/xmpp-clients-bots/proposed-extensions/muc-sub/