Getting “recipient-unavailable(404)” while joining the Group after getting the invitation for Multiuser Chat

 ̄綄美尐妖づ 提交于 2019-12-23 05:32:08

问题


I am Creating Group in android using following code

MultiUserChat muc = new MultiUserChat(connection, groupName + "@conference.jabber.org");

setConfig(muc, groupName);
muc.create(groupName);
muc.join("ABC");
groups.add(groupName);


private void setConfig(MultiUserChat multiUserChat, String groupName) {
   try {

        Form form = multiUserChat.getConfigurationForm();
        Form submitForm = form.createAnswerForm();
        for (Iterator<FormField> fields = submitForm.getFields(); fields
                .hasNext();) {
            FormField field = (FormField) fields.next();
            if (!FormField.TYPE_HIDDEN.equals(field.getType())
                    && field.getVariable() != null) {
                submitForm.setDefaultAnswer(field.getVariable());
            }
        }

        List<String> owners = new ArrayList<String>();
        owners.add("abc" + "@" + "@conference.jaber.org");
        submitForm.setAnswer("muc#roomconfig_roomowners", owners);
        submitForm.setAnswer("muc#roomconfig_roomname", groupName);
        submitForm.setAnswer("muc#roomconfig_publicroom", true);
        submitForm.setAnswer("muc#roomconfig_persistentroom", true);

        multiUserChat.sendConfigurationForm(submitForm);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

After this Code My group Appears in the XMPP Server, and then I send the invitation using following Code

muc.invite("abab@" + "jabber.org", "Lets have ");

Then the next user USER2 also receives the Invitation, when try to join the Group using

MultiUserChat mucJoin = new MultiUserChat(connection, groupName);
mucJoin.join("USER2");

Then I got the Error "recipient-unavailable(404)".

Please let me know where I am doing wrong, and why I am getting this Error. Thanks Bajwa


回答1:


I got the solution of my problem, I was configuring the room before creating and joining it as below

setConfig(muc, groupName);
muc.create(groupName);
muc.join("ABC");
groups.add(groupName);

and I just changed the steps as below

muc.create(groupName);
muc.join("ABC");
groups.add(groupName);
setConfig(muc, groupName);

I am accepting my answer.



来源:https://stackoverflow.com/questions/25697429/getting-recipient-unavailable404-while-joining-the-group-after-getting-the-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!