powered by Jive Software

Best practices for MUC creation/join

I continue to have trouble creating and/or joining a chat room with Smack. Sometimes my code works, sometimes it doesn’'t. I believe the behavior varies based on whether or not a room pre-exists.

How can I determine if a room already exists? MUC.getRoomInfo() doesn’'t seem completely reliable. A 404 error seems to mean that the room does not exist, though sometimes getRoomInfo() returns without error but with an occupant count of -1, which seems to usually[/i] also indicate that the room needs to be created rather than joined.

What are the best practices to check on the existance of a room and then either join it if it already exists or create it if needed? Do I really have to try getRoomInfo() and then catch and parse the XMPPException to know if a room exists? Surely there must be a better way. Thanks.

What i have been doing is catching the exception.