From 7bb63a5d8db8ac658bc7df33193465d09a7f21c4 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Sun, 31 Oct 2004 03:49:15 +0000 Subject: [PATCH] Updated example of "creation of reserved rooms". git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2404 b35dd754-fafc-0310-a699-88a17e54d16e --- documentation/extensions/muc.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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);