Help request with getting list of rooms

Hi,
I’m trying to get a list of rooms available to a user using smack 4.3.1
this is the function I’m using at the moment

public void getRoomlist ()
{
MultiUserChatManager multiChat = MultiUserChatManager.getInstanceFor(connection);
Set rooms = multiChat.getJoinedRooms();
System.out.println("Rooms: " + rooms.size());
for (EntityBareJid room : rooms)
{
System.out.println(room.toString());
}
}

however it doesn’t list any rooms for a user I know should be able to access 2

I’m not sure if I’ve made an error or not, so any help is appreciated
pheonixfire

The method getJoinedRooms() returns the list of currently joined rooms, not the list of all (accessible|available) rooms. It sounds like you want to call getRoomsHostedBy() with the local MUC service as argument.

could you provide an example of how to retrieve this info, I haven’t used the map data type
before so I’m a little unsure how to use it

any help is appreciated
pheonixfire

Well the returned Map “maps” the XMPP addresses (aka “JIDs”) of the hosted rooms to a class which holds further information about that room.

Ah, so it works similar to a json data type then

Thanks
pheonixfire

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.