在Android smack 4.2.0-beta1中获取MucConfigurationNotSupportedException [英] Getting MucConfigurationNotSupportedException In android smack 4.2.0-beta1
问题描述
我正在开发用于一对一聊天和群聊的聊天应用程序。
I am developing chat application for one to one chat and group chat.
我已经成功完成了一对一聊天。
I have successfully done one to one chat.
使用下面的链接,我创建了群聊。
Using the below link I have created Group chat.
我可以在管理面板中看到该组,但是只有一个用户可用,但是我创建了具有三个成员的该组。
我在这里添加了我的代码。
I can see the group in admin panel but There is only a single user available, But I have created this group with three members. Here I have added my code.
public void createGroupChat() {
String DomainName = "conference."+ServiceAddress;
// Create a MultiUserChat using a Connection for a room
// Get the MultiUserChatManager
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
try {
EntityBareJid jid = JidCreate.entityBareFrom("mychatroom3" + "@"
+ DomainName);
// Create a MultiUserChat using an XMPPConnection for a room
MultiUserChat muc = manager.getMultiUserChat(jid);
// Prepare a list of owners of the new room
Set<Jid> owners = JidUtil.jidSetFrom(new String[]{"admin" + "@"
+ DomainName, "dev1" + "@"
+ DomainName, "dev2" + "@"
+ DomainName});
// Create the room
Resourcepart nickname = Resourcepart.from("admin");
muc.create(nickname).getConfigFormManager().setRoomOwners(owners).submitConfigurationForm();
muc.join(nickname);
Log.e("Group chat", "Created");
Toast.makeText(context,
"Group chat" + "Created",
Toast.LENGTH_SHORT).show();
} catch (XmppStringprepException e) {
e.printStackTrace();
} catch (MultiUserChatException.MucAlreadyJoinedException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (XMPPException.XMPPErrorException e) {
e.printStackTrace();
} catch (MultiUserChatException.MissingMucCreationAcknowledgeException e) {
e.printStackTrace();
} catch (NotConnectedException e) {
e.printStackTrace();
} catch (SmackException.NoResponseException e) {
e.printStackTrace();
} catch (MultiUserChatException.NotAMucServiceException e) {
e.printStackTrace();
} catch (MultiUserChatException.MucConfigurationNotSupportedException e) {
e.printStackTrace();
}
}
我得到的例外情况
08-01 05:58:14.589 917-917/com.agarangroup.hello W/System.err: org.jivesoftware.smackx.muc.MultiUserChatException$MucConfigurationNotSupportedException: The MUC configuration 'muc#roomconfig_roomowners' is not supported by the MUC service
08-01 05:58:14.590 917-917/com.agarangroup.hello W/System.err: at org.jivesoftware.smackx.muc.MucConfigFormManager.setRoomOwners(MucConfigFormManager.java:137)
08-01 05:58:14.590 917-917/com.agarangroup.hello W/System.err: at com.agarangroup.hello.Services.MyXMPP.createGroupChat(MyXMPP.java:331)
08-01 05:58:14.590 917-917/com.agarangroup.hello W/System.err: at com.agarangroup.hello.slidingtab.chats.GroupChatActivity.onCreate(GroupChatActivity.java:99)
推荐答案
有2种情况:
1)您的会议服务不支持所有者(取决于服务) r,您的情况是Ejabber,这听起来不正常)
There are 2 cases: 1) Your conference service does not supports owners (depends by server, Ejabber in your case, and this doesn't sounds normal)
2)您的配置表单未完成为文档说,您需要创建一个完整的表格。
2) Your config form it's not completed as documentation says and you need to create a full form.
解决方法:替换此行:
muc.create(nickname).getConfigFormManager().setRoomOwners(owners).submitConfigurationForm();
具有:
muc.create(nickname);
Form form = muc.getConfigurationForm().createAnswerForm();
form.setAnswer("muc#roomconfig_roomowners", owners);
muc.sendConfigurationForm(form);
注意名称:
您的 DomainName 是服务会议名称+服务器域名。
所有者可以是JID( foo @ myserver ),并且与服务无关(因此, foo@service.myserver ),即使服务器,它也不是有效用户会接受它。)
your DomainName it's the Service conference name + Server Domain Name. An owner can be a JID (foo@myserver) and not related on service (so foo@service.myserver it's not a valid user, even if server will accept it).
使用以下方法解决您的所有者问题:
Fix your owners with:
"admin" + "@" + ServiceAddress, "dev1" + "@" + ServiceAddress, "dev2" + "@" + ServiceAddress
这篇关于在Android smack 4.2.0-beta1中获取MucConfigurationNotSupportedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!