Get list of public rooms?

Hello all!

I need to get the list of rooms in my server, but i didnt find how to do that with smack in the examples/tutorials.

Can anyone sugest my the way ?

Thanks!

Hi,

You can get a list of public rooms using the MultiUserChat, HostedRoom, and RoomInfo objects by using the following pseudo-code:

// Gets all the available rooms from the server
Collection<HostedRoom> hostedRooms = MultiUserChat#getHostedRooms(XMPPConnection connection, String serviceName); for (HostedRoom hostedRoom : hostedRooms) {    // Get more detailed information about each room
   RoomInfo info = MultiUserChat#getRoomInfo(XMPPConnection connection, hostedRoom.getJid());    // Extract whatever information you want about each room
   info.getSubject();
}

Note that connection refers to your current connection to the server and “serviceName” refers to the address to the rooms on your server. Typically the address is “conference.” where server is your server domain name.

You can find the documentation for these methods here:

MultiUserChat JavaDoc

Chris