如何发送房间配置表格并使用smack 4.3.4从android创建持久房间

问题描述 投票:0回答:1

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

android openfire smack multiuserchat
1个回答
0
投票
        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);

       This is how you can send the room configuration from and configure room.
© www.soinside.com 2019 - 2024. All rights reserved.