Creating the GroupChat-room on the fly, when users are active

Hi,

I want to create the GroupChat-room when users are active. Based on following code, I am able to create chat-room (set persistance to false), but it shows the ?No response from server? when executing the call setConfigurationForm() from the MultiUserChat object.

String roomId =?user@serviceName?;

MultiUserChat muc = new MultiUserChat(con, roomed);

muc.create(?Test?);

// create configuration

Form form = muc.getConfigurationForm();

Form submitForm = form.createAnswerForm();

for (Iterator fields = form.getFields(); fields.hasNext():wink: {

FormField field = (FormField) fields.next();

if (FormField.TYPE_BOOLEAN.equals(field.getType()) &&

(field.getVariable().equals(“persistance”))) {

submitForm.setAnswer(field.getVariable(), new Boolean(false));

}

}

// Sets the new owner of the room

muc.sendConfigurationForm(submitForm); // ERROR shows

No response from server.:

org.jivesoftware.smackx.muc.MultiUserChat.sendConfigurationForm(MultiUserChat.ja va:556)

at com.gropchat.TestGroupChat.main(TestGroupChat.java:80)

If any body knows, please reply ASAP.

Thanks

Jeyaraj

I think the form field is “persistentroom” and not “persistance”.

Yep it is:

if (“muc#roomconfig_persistentroom”.equals(fieldVariable)) {

formField = new FormField(“muc#roomconfig_persistentroom”);

formField.addValue(“1”);

submitForm.addField(formField);

http://www.jabber.org/registrar/formtypes.html#http://jabber.org/protocol/muc#ro omconfig

Change it to the correct property name and see if that helps you out.