【发布时间】:2013-11-08 08:26:21
【问题描述】:
我正在成功创建一个新的 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);
【问题讨论】:
标签: android openfire smack asmack