List of not public rooms

Hi, all!

I use smack-api and Openfire server for my application.

I (user A) try create MultiUserChat with this configuration:

answerform.setAnswer(“muc#roomconfig_publicroom”, false);

answerform.setAnswer(“muc#roomconfig_persistentroom”, true);

Then user A, invite user B and C, users accept invite and group chat works fine.

After that all users logout.

So answer is how user A can get list of room that are not public and persistent, for join again?muc

Hello,

You should be able to use the static method: MultiUserChat#getHostedRooms

I believe when you use this method, the server automatically considers the user account that is making the request and includes both the public and private rooms the requesting user is allowed to join.

Chris

Thanks you for answer.

But I know this method and already use it, and by this way I can’t get only public room.

I try many times. May be I do something wrong, but in javadoc for this method wright: " Hosted rooms by a chat service may be discovered if they are configured to appear in the room directory"

Any ideas?

Thanks

Okay, it looks like you are right that it is not possible to get a list of private rooms. Instead, it seems your best bet is to leave the room as public so that it is returned in the normal list, but set restrictions on the room so that only certain users can actually join it.

// Make the room restricted to invited members only

form.setAnswer(“muc#roomconfig_membersonly”, true);

// Set the current user or other users to be the room owner if you want

form.setAnswer(“muc#roomconfig_roomowners”, Arrays.asList(“user@domain”));

Then, whenever a user is invited they will be added to the members list and even though all users will be able to see all the rooms, users will only be able to join rooms that they have been invited to. If a user tries to join a room they don’t have permission to join, then you will get an XMPPException with an error code of 407 and you can display an appropriate message to the user. This is what Jive’s Spark client does.

Chris

So if i right understand, if user create persisted, not public room and forgot id of room hi can’t join on it?

All room we can see only in openfire admin console?