0

By reading asmack source, when create a chat room and invite user to join, the message add a extendsion MUCUser.Invite .

public void invite(Message message, String user, String reason) {
    // TODO listen for 404 error code when inviter supplies a non-existent JID
    message.setTo(room);

    // Create the MUCUser packet that will include the invitation
    MUCUser mucUser = new MUCUser();
    MUCUser.Invite invite = new MUCUser.Invite();
    invite.setTo(user);
    invite.setReason(reason);
    mucUser.setInvite(invite);
    // Add the MUCUser packet that includes the invitation to the message
    message.addExtension(mucUser);

    connection.sendPacket(message);
}

I use message.getExtension( "x","http://jabber.org/protocol/muc#user"), but it return DefaultPacketExtension, not MUCUser.Invite. So I doubt how i can get inviter name. Any help will be appreciative!

Flow
  • 23,572
  • 15
  • 99
  • 156
Evan
  • 16
  • 2

1 Answers1

0

Using message.getBody(), it can get invite reason and content which contains inviter name. With subString(), I get the inviter name. But I don't think it is a good solution, my doubt in the question is not solved。

Evan
  • 16
  • 2