80,351
社区成员
发帖
与我相关
我的任务
分享
try {
MultiUserChat multiUserChat = new MultiUserChat(connection,roomid);
multiUserChat.create("room_nickname");
Form form;
form = multiUserChat.getConfigurationForm();
Form submitForm = form.createAnswerForm();
for (Iterator<?> fields = form.getFields(); fields.hasNext();) {
FormField field = (FormField) fields.next();
if (!FormField.TYPE_HIDDEN.equals(field.getType())
&& field.getVariable() != null) {
submitForm.setDefaultAnswer(field.getVariable());
}
}
submitForm.setAnswer("muc#roomconfig_persistentroom", true);
submitForm.setAnswer("muc#roomconfig_membersonly", false);
submitForm.setAnswer("muc#roomconfig_allowinvites", true);
submitForm.setAnswer("muc#roomconfig_enablelogging", true);
submitForm.setAnswer("x-muc#roomconfig_reservednick", true);
submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
submitForm.setAnswer("x-muc#roomconfig_registration", false);
multiUserChat.sendConfigurationForm(submitForm);
} catch (XMPPException e) {
e.printStackTrace();
}