XMPP会议室设置MUC

来源:互联网 发布:unity3d自学教程 编辑:程序博客网 时间:2024/04/26 02:46
房间名称 text-single muc#roomconfig_roomname
描述 text-single muc#roomconfig_roomdesc
允许占有者更改主题boolean muc#roomconfig_changesubject
最大房间占有者人数list-single muc#roomconfig_maxusers
其 Presence 是 Broadcast 的角色list-multi muc#roomconfig_presencebroadcast
列出目录中的房间 boolean muc#roomconfig_publicroom
房间是持久的 boolean muc#roomconfig_persistentroom
房间是适度的 boolean muc#roomconfig_moderatedroom
房间仅对成员开放 boolean muc#roomconfig_membersonly
允许占有者邀请其他人boolean muc#roomconfig_allowinvites
需要密码才能进入房间boolean muc#roomconfig_passwordprotectedroom
密码 text-private muc#roomconfig_roomsecret
能够发现占有者真实 JID 的角色list-single muc#roomconfig_whois
登录房间对话 boolean muc#roomconfig_enablelogging
仅允许注册的昵称登录boolean x-muc#roomconfig_reservednick
允许使用者修改昵称boolean x-muc#roomconfig_canchangenick
允许用户注册房间 boolean x-muc#roomconfig_registration
房间管理员 jid-multi muc#roomconfig_roomadmins
房间拥有者 jid-multi muc#roomconfig_roomowners

/**
代码片段
**/
MultiUserChat chatRoom = new MultiUserChat(SparkManager.getConnection(), roomName + "@" + serviceName);
ConferenceUtils.joinRoom(chatRoom, SparkManager.getUserManager().getNickname(), key);
//TODO 取得服务器上记录的房间属性信息
Form submitForm=chatRoom.getConfigurationForm().createAnswerForm();
if (key!=null&&!"".equals(key)){
    //使用密码
    submitForm.setAnswer("muc#roomconfig_passwordprotectedroom", true);
    //设置密码
    submitForm.setAnswer("muc#roomconfig_roomsecret", key);
}
//最大用户数
 List<String> list = new ArrayList<String>();
 list.add("0");
if (list.size() > 0) {
 submitForm.setAnswer("muc#roomconfig_maxusers", list);
}

//房间时永久的true【临时房间在所有人退出后就会被释放】
submitForm.setAnswer("muc#roomconfig_persistentroom", false);
//在目录中 列出 房间
submitForm.setAnswer("muc#roomconfig_publicroom", true);
//设置房间主题
String descrip= message.getString("descrip");
submitForm.setAnswer("muc#roomconfig_changesubject", true);
submitForm.setAnswer("muc#roomconfig_roomdesc", descrip);
chatRoom.sendConfigurationForm(submitForm);
0 0
原创粉丝点击