mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Updated example of "creation of reserved rooms".
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2404 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
4519699dfa
commit
7bb63a5d8d
1 changed files with 7 additions and 8 deletions
|
@ -62,7 +62,7 @@ In this example we can see how to create an instant room: <br>
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
In this example we can see how to create a reserved room: <br>
|
||||
In this example we can see how to create a reserved room. The form is completed with default values: <br>
|
||||
<blockquote>
|
||||
<pre> <font color="#3f7f5f">// Create a MultiUserChat using an XMPPConnection for a room</font>
|
||||
MultiUserChat muc = new MultiUserChat(conn1, <font color="#0000FF">"myroom@conference.jabber.org"</font>);
|
||||
|
@ -78,15 +78,14 @@ In this example we can see how to create a reserved room: <br>
|
|||
for (Iterator fields = form.getFields(); fields.hasNext();) {
|
||||
FormField field = (FormField) fields.next();
|
||||
if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) {
|
||||
<font color="#3f7f5f">// Add the field values to a List</font>
|
||||
List values = new ArrayList();
|
||||
for (Iterator it = field.getValues(); it.hasNext();) {
|
||||
values.add((String) it.next());
|
||||
}
|
||||
<font color="#3f7f5f">// Sets the new answer to the form to submit</font>
|
||||
submitForm.setAnswer(field.getVariable(), values);
|
||||
<font color="#3f7f5f">// Sets the default value as the answer</font>
|
||||
submitForm.setDefaultAnswer(field.getVariable());
|
||||
}
|
||||
}
|
||||
<font color="#3f7f5f">// Sets the new owner of the room</font>
|
||||
List owners = new ArrayList();
|
||||
owners.add(<font color="#0000FF">"johndoe@jabber.org"</font>);
|
||||
submitForm.setAnswer(<font color="#0000FF">"muc#roomconfig_roomowners"</font>, owners);
|
||||
<font color="#3f7f5f">// Send the completed form (with default values) to the server to configure the room</font>
|
||||
muc.sendConfigurationForm(submitForm);
|
||||
</pre>
|
||||
|
|
Loading…
Reference in a new issue