1
votes

I'm using smack 4.1 in my application, i'm able to send invitations but I'm failing receiving them

In fact when debugging i was receiving the invitation in my ChatMessageListener() ,in the packet Extension i can get the whole invitation but i don't want to pares XML .

my InvitationLisenter() is never called

final MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
    manager.addInvitationListener(new InvitationListener() {
        @Override
        public void invitationReceived(XMPPConnection xmppConnection, MultiUserChat multiUserChat, String s, String s1, String s2, Message message) {
            try {
                multiUserChat.join(mUserName);
            } catch (SmackException.NoResponseException e) {
                e.printStackTrace();
            } catch (XMPPException.XMPPErrorException e) {
                e.printStackTrace();
            } catch (SmackException.NotConnectedException e) {
                e.printStackTrace();
            }
        }
    });
1

1 Answers

2
votes

There are two types of room invites in xmpp ,

Direct Invitation

that is send as a normal message and received with ChatMessageListener() ,and i'm using this code to get the invite from the message

GroupChatInvitation invite = (GroupChatInvitation)result.getExtension("x","jabber:x:conference");

and
Mediated Invitation

that is received with InvitationLisenter()