【问题标题】:How to send room configuration form and create persistence rooms from android using smack 4.3.4如何使用 smack 4.3.4 从 android 发送房间配置表单并创建持久性房间
【发布时间】:2020-04-19 18:03:27
【问题描述】:

我在创建持久性房间和 MUC 时遇到问题,无法发送房间配置表。我发送的未设置为表单字段的值和默认值发送到服务器。

【问题讨论】:

    标签: android openfire smack multiuserchat


    【解决方案1】:
            multiUserChatManager = MultiUserChatManager.getInstanceFor(connection);
    
            multiUserChat = multiUserChatManager.getMultiUserChat(JidCreate.entityBareFrom(roomJID));
    
            multiUserChat.create(Resourcepart.from(nickname));
    
            Form form = multiUserChat.getConfigurationForm();
            Form submitForm = form.createAnswerForm(); submitForm.getField("muc#roomconfig_publicroom").addValue("1");
            submitForm.getField("muc#roomconfig_enablelogging").addValue("1");
            submitForm.getField("x-muc#roomconfig_reservednick").addValue("0");
            submitForm.getField("x-muc#roomconfig_canchangenick").addValue("0");
            submitForm.getField("x-muc#roomconfig_registration").addValue("0");
            submitForm.getField("muc#roomconfig_passwordprotectedroom").addValue("0");
            submitForm.getField("muc#roomconfig_roomname").addValue(roomName);
            submitForm.getField("muc#roomconfig_whois").addValue("participants");
            submitForm.getField("muc#roomconfig_membersonly").addValue("1");
            submitForm.getField("muc#roomconfig_persistentroom").addValue("1");
            multiUserChat.sendConfigurationForm(submitForm);
    

    这是您发送房间配置和配置房间的方式。

    【讨论】:

      猜你喜欢
      • 2018-01-19
      • 2015-04-09
      • 1970-01-01
      • 1970-01-01
      • 2018-01-22
      • 2018-01-17
      • 1970-01-01
      • 2018-05-27
      • 1970-01-01
      相关资源
      最近更新 更多