Smack / openfire如何将用户永久保留在群聊室中

时间:2013-10-29 09:10:08

标签: android openfire smack asmack

我正在成功创建一个新的multiUserChat会议室并将用户添加到此会议室但是当用户离线时他们会离开会议室 如何永久保持用户在房间里我在openfire中搜索了房间配置,没有这样的选项请帮助,如果不可能,最好的方式是什么才能建立永久的群聊(例如whatapp grroup)???这是我正在使用的代码

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

1 个答案:

答案 0 :(得分:3)

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