创建MultiUserChat会议室时未授权错误

时间:2013-10-21 07:10:41

标签: xmpp smack asmack multiuserchat

我正在尝试使用Smack创建一个即时聊天室,但是服务器返回一个错误代码为401并且输入=“AUTH”的IQ数据包和一个消息包,其中包含房间从入口锁定直到配置为止的消息证实

final MultiUserChat muc = new MultiUserChat(connection, chatName+"@conference.123");
try {
     muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
     muc.create(chatName);
     } catch (XMPPException e) {
        Log.e("Exception", e.getMessage());
     }

这给出了一个例外(未授权(401))。 以下是从服务器收到的两个数据包:

<iq id="J1O5y-5" to="akshay@123/Smack" from="test@conference.123" type="error"><error code="401" type="AUTH"><not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

<message to="akshay@123/Smack" from="test@conference.123" type="groupchat"><body>This room is locked from entry until configuration is confirmed.</body></message>

那么我需要对服务器配置进行任何更改,或者代码中是否存在任何问题?

2 个答案:

答案 0 :(得分:0)

如何更改订单如下:

muc.create(nickName);
muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

希望这会有所帮助:)

答案 1 :(得分:0)

它对我有用。请试试这个。

public void createRoom(String r,String n) throws XMPPException {
    // TODO Auto-generated method stub
    String t = r + "@conference.localhost";

    MultiUserChat muc = new MultiUserChat(connection, t);

    muc.create(n);

    muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

}
相关问题