How to send room configuration form and create persistence rooms from android using smack 4.3.4

后端 未结 1 1167
孤独总比滥情好
孤独总比滥情好 2021-01-27 07:52

I am facing problem for create persistence room and MUC, Not able to send room configuration form. Values i send that are not set to form fields and default values are send to s

相关标签:
1条回答
  • 2021-01-27 08:47
            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.

    0 讨论(0)
提交回复
热议问题