2013-10-29 54 views
1

我正在创建一个新的多用户聊天室,并将用户添加到这个房间,但是当用户离线时,他们离开房间 如何让用户保持在永久的房间我在openfire搜索房间配置,没有这样的选项,请帮助,如果不可能什么是一个永久性群聊的最佳方式(如whatapp群)?这里是我正在使用的代码Asmack/openfire如何让用户永久进入分组聊天室

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); 

回答

3

XMPP MUC协议不支持这样的事情。一旦加入房间的完整JID(或者,如果MUC组件支持从JID的多个资源加入MUC),则JID也将脱机,JID也将离开MUC。

+0

那么什么是最好的路线,然后做groupChat用户属于组将保持在像WhatsApp组聊天?????????请有人帮忙 –

+1

首先想到:与XMPP PubSub – Flow

+0

实现群聊,所以openfire和asmack无法实现我的req?我尝试过“SharedGroups”,但openfire客户端无法管理“sharedGroups”。任何想法 ?? –

相关问题