Problem with InvitationRejectionListener

I am working on adding MultiUserChat support to my messenger application and I am having a problem with the InvitationRejectionListener(). I have a method that creates MultiUserChat rooms once a room has been created I add an InvitationRejectionListener to that room. So theoretically when an invitation is rejected the user who did the inviting should receive the rejection notice. For some odd reason the inviter receives a rejection for each room that exists not just the one that the invitee declined the invitation to. The invitationDeclined() method in the rejection listener only takes two strings invitee and reason. So there is currently no way to check and see what room the decline should be sent to. I am currently working around this by sending the room name in the reason string and parsing it out so that I can do if (roomName.equals(rejectionRoomName)){ sendRejection();}. If there is something I am missing or if I am doing something wrong please let me know.

Thanks,

E

Well, I seem to be getting no response, but this seems to me like it is a bug. There doesn’'t seem to be any other way to make this work other than the hackish way I am making it work.

Any input is appreciated,

E

Hi,

I tried and it worked fine for me, do you have some sample code to reproduce the error?

Here’‘s what I tried, I’'m using the last version of smack in the svn, not a release.

XMPPConnection conn = new XMPPConnection("domain");
            conn.getAccountManager().createAccount("user1", "pass");
            conn.getAccountManager().createAccount("user2", "pass");
                        conn.login("user1", "pass");
            XMPPConnection conn2 = new XMPPConnection("domain");
            conn2.login("user2", "pass");             // MUC 1 with user1
            final MultiUserChat muc = new MultiUserChat(conn, "myroom@conference.domain");
            muc.create("testbot");
            muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
            muc.addInvitationRejectionListener(new InvitationRejectionListener() {
                public void invitationDeclined(String invitee, String reason) {
                    System.out.println("User 1 recives a rejected invitation from user: " + invitee + ", room: " + muc.getRoom());
                }
            });
                                    // MUC 2 with also user1
            final MultiUserChat muc2 = new MultiUserChat(conn, "myroom2@conference.domain");
            muc2.create("testbot2");
            muc2.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
            muc2.addInvitationRejectionListener(new InvitationRejectionListener() {
                public void invitationDeclined(String invitee, String reason) {
                    System.out.println("User 1 recives a rejected invitation from user: " + invitee + ", room: " + muc2.getRoom());
                }
            });             //User 2 who will reject the invitation
            MultiUserChat.addInvitationListener(conn2, new InvitationListener() {
                public void invitationReceived(XMPPConnection conn, String room, String inviter, String reason,
                        String password, Message message) {
                    System.out.println("User 2 rejects inivitation from inviter: " + inviter + ", room: " + room);
                    MultiUserChat.decline(conn, room, inviter, "I''m not intrested");
                            }
            });
                        Thread.sleep(300);
                        muc.invite("user2@domain", "none");
                        Thread.sleep(1000);
                        // Destroy the new room
            muc.destroy("The room has almost no activity...", null);
                        conn.getAccountManager().deleteAccount();
            conn2.getAccountManager().deleteAccount();

It only prints:

User 2 rejects invitation inviter: user1@intel01, room: myroom@conference.intel01

User 1 receives a rejected invitation from user: user2@intel01, room: myroom@conference.intel01

So the second MUC didn’'t receive a reject