Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将成员添加到XMPP中的MUC(SMACK)_Java_Xmpp_Openfire_Smack_Multiuserchat - Fatal编程技术网

Java 将成员添加到XMPP中的MUC(SMACK)

Java 将成员添加到XMPP中的MUC(SMACK),java,xmpp,openfire,smack,multiuserchat,Java,Xmpp,Openfire,Smack,Multiuserchat,我正在尝试使用XMPP(smack)创建多用户聊天。创建聊天室后,当我尝试加入聊天室时,MocMember的中没有加入成员的条目 房间代码的创建如下所示: public void createMultiUserChatRoom(String roomName, String nickName) { MultiUserChatManager multiUserChatManager = MultiUserChatManager.getInstanceFor(connection)

我正在尝试使用XMPP(smack)创建多用户聊天。创建聊天室后,当我尝试加入聊天室时,MocMember的中没有加入成员的条目

房间代码的创建如下所示:

public void createMultiUserChatRoom(String roomName, String nickName) {

        MultiUserChatManager multiUserChatManager = MultiUserChatManager.getInstanceFor(connection);

        MultiUserChat multiUserChat = multiUserChatManager.getMultiUserChat(roomName+"@conference.localhost");

        try {
            multiUserChat.create(nickName);

            Form form = multiUserChat.getConfigurationForm();
            Form submitForm = form.createAnswerForm();

            List<FormField> formFieldList = submitForm.getFields();
            for (FormField formField : formFieldList) {
                if(!FormField.Type.hidden.equals(formField.getType()) && formField.getVariable() != null) {
                    submitForm.setDefaultAnswer(formField.getVariable());
                }
            }

            submitForm.setAnswer("muc#roomconfig_persistentroom", true);
            submitForm.setAnswer("muc#roomconfig_publicroom", true);
            submitForm.setAnswer("muc#roomconfig_enablelogging", true);
            submitForm.setAnswer("x-muc#roomconfig_reservednick", false);
            submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
            submitForm.setAnswer("x-muc#roomconfig_registration", false);
            submitForm.setAnswer("muc#roomconfig_passwordprotectedroom", false);
            submitForm.setAnswer("muc#roomconfig_roomname", roomName);
             submitForm.setAnswer("muc#roomconfig_whois", Arrays.asList("none"));
            multiUserChat.sendConfigurationForm(submitForm);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
来自服务器的响应:

<message to="admin@localhost/Smack" id="h7axM-14" type="groupchat" from="team6@conference.localhost/roy"><body>roy : You have joined the group : team6</body><x xmlns="jabber:x:delay" stamp="20160623T12:15:50" from="team6@conference.localhost/roy"/></message>
presence :<presence to='admin@localhost/Smack' id='WR9Dy-12'><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='owner' jid='admin@localhost/Smack' role='moderator'></item></x><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
roy:您已加入组:team6
出席:

我没有得到任何错误。有人能告诉我我错在哪里吗?

你不能因为加入一个房间就获得会员资格。加入房间后,您就是XEP-0045术语的参与者。

填写配置表时,您需要填写以下部分:

<field
      label='Room Admins'
      type='jid-multi'
      var='muc#roomconfig_roomadmins'>
    <value>wiccarocks@shakespeare.lit</value>
    <value>hecate@shakespeare.lit</value>
  </field>

<field
          label='Room Owners'
          type='jid-multi'
          var='muc#roomconfig_roomowners'/>

wiccarocks@shakespeare.lit
hecate@shakespeare.lit

管理员和所有者保存在管理的表中,如果配置已更新且未提及现有管理员或所有者,则服务器假定其从属关系已更改为成员,因此,它将条目移动到mocMember的表中。

那么该参与者如何在数据库中拥有条目?我不认为Openfire将参与者保存在数据库中是的,它将成员保存在数据库中。我已经通过从openfire服务器添加它进行了检查。
<field
      label='Room Admins'
      type='jid-multi'
      var='muc#roomconfig_roomadmins'>
    <value>wiccarocks@shakespeare.lit</value>
    <value>hecate@shakespeare.lit</value>
  </field>

<field
          label='Room Owners'
          type='jid-multi'
          var='muc#roomconfig_roomowners'/>