我使用以下代码
在android中创建组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();
}
}
此代码后我的组出现在XMPP服务器中,然后我使用以下代码发送邀请
muc.invite("abab@" + "jabber.org", "Lets have ");
当尝试使用
加入群组时,下一个用户USER2也会收到邀请MultiUserChat mucJoin = new MultiUserChat(connection, groupName);
mucJoin.join("USER2");
然后我收到错误&#34;收件人不可用(404)&#34;。
请告诉我我在哪里做错了,以及为什么我收到此错误。 谢谢 BAJWA
答案 0 :(得分:0)
我得到了问题的解决方案,我在创建和加入之前配置了房间,如下所示
setConfig(muc, groupName);
muc.create(groupName);
muc.join("ABC");
groups.add(groupName);
我刚刚更改了以下步骤
muc.create(groupName);
muc.join("ABC");
groups.add(groupName);
setConfig(muc, groupName);
我接受了我的回答。