从myroom @ conference收到的XMPP错误回复。**** / myroom@conference.****:XMPPError:item-not-found - 取消

时间:2018-01-19 11:22:52

标签: android xmpp smack multiuserchat

我无法加入房间。我已经阅读了文档XMPP Instant Room Error

以下是我如何创建即时空间:

 try {
        UserSearchManager usm = new UserSearchManager(Utils.connection);

        List<DomainBareJid> services = usm.getSearchServices();

        String roomjid = "myroom@" + services.get(0);

        mucJid = JidCreate.entityBareFrom(roomjid);
        Log.d(TAG, mucJid.toString());

        // Create the nickname.
        nickname = Resourcepart.from(roomjid);

        Log.d(TAG, nickname.toString());
    } catch (XmppStringprepException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
    } catch (SmackException.NotConnectedException e) {
        e.printStackTrace();
    } catch (XMPPException.XMPPErrorException e) {
        e.printStackTrace();
    }

    // Get the MultiUserChatManager
    manager = MultiUserChatManager.getInstanceFor(Utils.connection);

    // Get a MultiUserChat using MultiUserChatManager
    MultiUserChat muc = manager.getMultiUserChat(mucJid);

    // Create the room and send an empty configuration form to make this an instant room
    try {

        // Prepare a list of owners of the new room
        Set<Jid> owners = JidUtil.jidSetFrom(new String[] { "54321@rahul", "12345@rahul" });

        muc.create(nickname)
                .getConfigFormManager()
                .setRoomOwners(owners)
                .submitConfigurationForm();

        muc.sendConfigurationForm(new Form(DataForm.Type.submit));

        muc.join(nickname);

        EntityBareJid invitemucJid = JidCreate.entityBareFrom("12345@rahul");
        muc.invite(invitemucJid, "testing");
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
    } catch (XMPPException.XMPPErrorException e) {
        e.printStackTrace();
    } catch (SmackException.NotConnectedException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (MultiUserChatException.MucAlreadyJoinedException e) {
        e.printStackTrace();
    } catch (MultiUserChatException.MissingMucCreationAcknowledgeException e) {
        e.printStackTrace();
    } catch (MultiUserChatException.NotAMucServiceException e) {
        e.printStackTrace();
    } catch (XmppStringprepException e) {
        e.printStackTrace();
    } catch (MultiUserChatException.MucConfigurationNotSupportedException e) {
        e.printStackTrace();
    }

MUC房间已成功创建。但是当我通过邀请听众检查并试图加入房间时。这是错误的。

邀请监听器代码如下:

    try {

        Resourcepart nickname = Resourcepart.from(room.getRoom().toString());

        room.join(nickname);

        Log.d(TAG, "room status---> " + room.isJoined());

        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (room.isJoined()) {
                    Toast.makeText(FriendListActivity.this, "Joined", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(FriendListActivity.this, "Not joined", Toast.LENGTH_SHORT).show();
                }
            }
        });

    } catch (XmppStringprepException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (XMPPException.XMPPErrorException e) {
        e.printStackTrace();
    } catch (SmackException.NotConnectedException e) {
        e.printStackTrace();
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
    } catch (MultiUserChatException.NotAMucServiceException e) {
        e.printStackTrace();
    }

以下是堆栈跟踪的屏幕截图

enter image description here

根据文件说明MUC房间被锁定。但是我已经创建了默认配置的即时空间。

0 个答案:

没有答案