powered by Jive Software

Locked room? Help me

Hi I created a MUC by below code:

public boolean createNewRoom(String roomname) {

boolean status = false;

MultiUserChat muc = null;

if (getConn().isConnected()) {

User user = Static.getInstance().getUser();

try {

String roomservice = roomname + Config.getConferenceServPrefix();

muc = new MultiUserChat(getConn(), roomservice);

muc.create(roomname);

muc.addMessageListener(this);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

groupSessions.put(roomname, muc);

status = true;

} catch (XMPPException e) {

System.out.println(e.getLocalizedMessage());

Static.getInstance().getNotificationPanel().showError(“Cannot create a room”);

}

if (status) {

try {

muc.join(user.getUsername() + Config.getDomainPrefix(), user.getPassword());

} catch (XMPPException e) {

System.out.println(e.getLocalizedMessage());

}

}

} else {

logout();

Static.getInstance().getNotificationPanel().showError(“You are not connected”);

Static.getInstance().getMainPanel().setState(MainPanel.INIT);

Static.getInstance().getMainPanel().resetOnlinePanel();

}

return status;

}

Why I always got message:

This room is locked from entry until configuration is confirmed.

This room is now unlocked.

This room is locked from entry until configuration is confirmed.

Can anybody show me some enlightment???

Thankyou in advance

Bromo

The messages you are seeing are normal. It means that the room will not allow anyone else to join until you send the configuration form that tells the server what the rules are for the room. You can find all the options for the room configuration here: http://www.xmpp.org/extensions/xep-0045.html Under the heading: “15.5.3 muc#roomconfig FORM_TYPE”. Then the message about the room is now unlocked is sent after you sent the default configuration form.

There seems to be a few minor issues with your code.

1.) The parameter passed into the MUC#create() method should be the current user’s nickname (not their ID), not the room name.

2.) You do not need to join a room you just created because the create method does that for you. Other clients that wish to join your room would still need to use the join() method, however and not the create method.

Chris

Tq bro … it works

Is this code valid also for spark?