powered by Jive Software

MUC getHostedRooms Problems

Hello,

I am attempting to populate a comboBox with the names of the rooms that are running on a Jabber Server.

So first I need to grab the Services that are running.


Collection servicesList = MultiUserChat.getServiceNames(conn); // conn = XMPP


I can then iterate over the collection to obtain a list of services.

I then need to find out the rooms hosted on the Service so


String service = (String)servicesIter.next();

Collection roomsList = MultiUserChat.getHostedRooms(conn, service);


I now run into my problem, I want to create new MUC’'s with the roomNames and then add these rooms to my comboBox but I cant seem to actually get at the room name.

I’‘ve tried to iterate over the Collection of hostedRooms but if I try and use whats inside I always run into a ClassCastException (Obviously my casting is wrong but I’'m all out of ideas )

I was wondering if anybody had a good solution to what I am trying to do or could point me in the right direction.

Many thanks.

Jon

Hi Jon,

To my mind, it should work if you iterate over roomList and create your MUCs as follows:

MultiUserChat muc = new MultiUserChat(conn,((HostedRoom)roomsListIter.next()).getJid());

Perhaps, you made a mistake between name of a room and its JID…

Another mistake can come from giving+ serviceName+ instead of serviceName.serverName to MultiUserChat#getHostedRooms().

Seb

Thanks ever so much Seb, works like a charm now