XMPP會議室設置MUC

房間名稱 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);
發佈了27 篇原創文章 · 獲贊 9 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章