我正在使用 smack 库使用 android 应用程序创建房间。
以下是使用 muc 创建群聊(房间)的代码:
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
muc = manager.getMultiUserChat("myroom@conference.192.168.1.4");
muc.create("myroom");
muc.sendConfigurationForm(new Form(DataForm.Type.submit));
以下是在 MUC 中执行上述命令创建组时的日志:
<presence to='myroom@conference.192.168.1.4/myroom' id='wvAb9-11'><x xmlns='http://jabber.org/protocol/muc'></x><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
<presence type="error" xmlns="jabber:client" id="wvAb9-11" from="myroom@conference.192.168.1.4/myroom" to="dk@yama/Smack"><x xmlns="http://jabber.org/protocol/muc"/><c xmlns="http://jabber.org/protocol/caps" node="http://www.igniterealtime.org/projects/smack" hash="sha-1" ver="NfJ3flI83zSdUDzCEICtbypursw="/><error type="cancel" code="404"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">S2S - destination host not found</text></error></presence>
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: remote-server-not-found - cancel
at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:232)
at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:311)
at org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:400)
at org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:376)
<presence to='myroom@conference.192.168.1.4/myroom' id='wvAb9-11'><x xmlns='http://jabber.org/protocol/muc'></x><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='NfJ3flI83zSdUDzCEICtbypursw='/></presence>
<presence type="error" xmlns="jabber:client" id="wvAb9-11" from="myroom@conference.192.168.1.4/myroom" to="dk@yama/Smack"><x xmlns="http://jabber.org/protocol/muc"/><c xmlns="http://jabber.org/protocol/caps" node="http://www.igniterealtime.org/projects/smack" hash="sha-1" ver="NfJ3flI83zSdUDzCEICtbypursw="/><error type="cancel" code="404"><remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">S2S - destination host not found</text></error></presence>
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: remote-server-not-found - cancel
at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:232)
at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:311)
at org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:400)
at org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:376)
at org.jivesoftware.smackx.muc.MultiUserChat.create(MultiUserChat.java:354)
at com.example.sufalam.tigasechatdemo.UserListActivity$3.onClick(UserListActivity.java:72)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)at org.jivesoftware.smackx.muc.MultiUserChat.create(MultiUserChat.java:354)
at com.example.sufalam.tigasechatdemo.UserListActivity$3.onClick(UserListActivity.java:72)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)