我正在成功创建一个新的 multiUserChat 房间并将用户添加到这个房间但是当用户离线时他们离开房间我怎样才能让用户永久留在房间我在 openfire 中搜索了房间配置并且没有这样的选项请帮忙如果不可能建立永久群聊(例如whatapp 组)的最佳方式是什么?这是我正在使用的代码
MultiUserChat muc = new MultiUserChat(MyApplication.connection, room);
// Create the room
SmackConfiguration.setPacketReplyTimeout(2000);
muc.create("testGroup2s2");
// Get the the room's configuration form
Form form = muc.getConfigurationForm();
// Create a new form to submit based on the original form
Form submitForm = form.createAnswerForm();
// Add default answers to the form to submit
for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
FormField field = (FormField) fields.next();
if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) {
// Sets the default value as the answer
submitForm.setDefaultAnswer(field.getVariable());
}
}
// Sets the new owner of the room
List<String> owners = new ArrayList<String>();
owners.add(MyApplication.connection.getUser() );
submitForm.setAnswer("muc#roomconfig_roomowners", owners);
muc.sendConfigurationForm(submitForm);