1

我正在成功创建一个新的 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);
4

1 回答 1

3

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

于 2013-10-29T15:38:09.283 回答