The group chat invitation packet extension is used to invite other users to a group chat room.
JEP related: N/A -- this protocol is outdated now that the Multi-User Chat (MUC) JEP is available (JEP-45). However, most existing clients still use this older protocol. Once MUC support becomes more widespread, this API may be deprecated.
To use the GroupChatInvitation packet extension to invite another user to a group chat room, address a new message to the user and set the room name appropriately, as in the following code example:
Message message = new Message("firstname.lastname@example.org"); message.setBody("Join me for a group chat!"); message.addExtension(new GroupChatInvitation("email@example.com")); con.sendPacket(message);The XML generated for the invitation portion of the code above would be:
<x xmlns="jabber:x:conference" jid="firstname.lastname@example.org"/>
To listen for group chat invitations, use a PacketExtensionFilter for the x element name and jabber:x:conference namespace, as in the following code example:
PacketFilter filter = new PacketExtensionFilter("x", "jabber:x:conference"); // Create a packet collector or packet listeners using the filter...