How to get all the room members in the MUC module?
We're adding a little functionality to send push notifications for MUC members that are offline/out of the room. We checked the MUC module code, and it's doing the following:
But I think that will only get us a list of the members currently in the room, and not all the members in the list, correct? How can we get a list of all the members belonging to that room, whether they are online or not?
Added by Bartosz Małkowski about 3 years ago
I'm not sure what you exactly have in mind. MUC doesn't keeps list of all occupants joined to room in the past if now they are disconnected now. If user disconnects, then Server sends presence offline to MUC what is equals to leaving room, and MUC forgets about him.
But if you have members-only room, each occupant must be stored in MUC database with assigned affiliation. You can get it with
tigase.muc.Room#getAffiliations (I know, very intuitive method name) and you can iterate over this list and check affiliation of each users with affiliation (@tigase.muc.Room#getAffiliation(tigase.xmpp.BareJID)@).
Please check XEP-0045 to see how affiliations works.