diff --git a/documentation/extensions/muc.html b/documentation/extensions/muc.html index edb77f8bc..329617102 100644 --- a/documentation/extensions/muc.html +++ b/documentation/extensions/muc.html @@ -62,7 +62,7 @@ In this example we can see how to create an instant room:
-In this example we can see how to create a reserved room:
+In this example we can see how to create a reserved room. The form is completed with default values:
      // Create a MultiUserChat using an XMPPConnection for a room
       MultiUserChat muc = new MultiUserChat(conn1, "myroom@conference.jabber.org");
@@ -78,15 +78,14 @@ In this example we can see how to create a reserved room: 
for (Iterator fields = form.getFields(); fields.hasNext();) { FormField field = (FormField) fields.next(); if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) { - // Add the field values to a List - List values = new ArrayList(); - for (Iterator it = field.getValues(); it.hasNext();) { - values.add((String) it.next()); - } - // Sets the new answer to the form to submit - submitForm.setAnswer(field.getVariable(), values); + // Sets the default value as the answer + submitForm.setDefaultAnswer(field.getVariable()); } } + // Sets the new owner of the room + List owners = new ArrayList(); + owners.add("johndoe@jabber.org"); + submitForm.setAnswer("muc#roomconfig_roomowners", owners); // Send the completed form (with default values) to the server to configure the room muc.sendConfigurationForm(submitForm);