Get MUC Occupants without joining

Is there a way to get a list of MUC occupants (nicknames and/or JIDs) without actually joining it? I see that there is support for getting subject, description and occupant count, but did not see a way to get the actual list within Smack. Or is this not possible according to the XMPP specification?

Thanks in advance,

Jeff

Hey Jeff,

It is possible to find out room occupants without joining the room. However, this only works for public rooms and the retrieved information is not the user JID but the Room JID (the <room@service/nick> by which an occupant is identified within the context of a room). The nickname would be the resource of the Room JID.

To retrieve this information you need to send a disco#items to the room itself. The following code will give you the proper idea:

ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);

    DiscoverItems items = discoManager.discoverItems("room@conference.myserver.com");

for (Iterator it = items.getItems(); it.hasNext():wink: {

DiscoverItems.Item item = (DiscoverItems.Item) it.next();

System.out.println("Room occupant: " + item.getEntityID());

}

/code

Regards,

– Gato