【问题标题】:Asmack/openfire How do I keep a user permanently in groupchat roomSmack/openfire 如何让用户永久留在群聊室
【发布时间】:2013-11-08 08:26:21
【问题描述】:

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

【问题讨论】:

    标签: android openfire smack asmack


    【解决方案1】:

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

    【讨论】:

    • 那么在用户所属群组的情况下进行群组聊天的最佳途径是什么?请有人帮忙
    • 第一个想法:使用 XMPP PubSub 实现群聊
    • 所以openfire和asmack没有办法实现我的req ??我尝试了“SharedGroups”,但 openfire 客户端无法管理“sharedGroups”。有什么想法吗??
    • Openfire 和 (a)Smack 支持 PubSub
    猜你喜欢
    • 2013-11-15
    • 2015-12-26
    • 1970-01-01
    • 2015-01-25
    • 2013-09-24
    • 2017-01-12
    • 2017-07-13
    • 1970-01-01
    • 2021-10-11
    相关资源
    最近更新 更多