Smack

org.jivesoftware.smackx
Class GroupChatInvitation

java.lang.Object
  extended by org.jivesoftware.smackx.GroupChatInvitation
All Implemented Interfaces:
PacketExtension

public class GroupChatInvitation
extends Object
implements PacketExtension

A group chat invitation packet extension, which is used to invite other users to a group chat room. To invite a 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("user@chat.example.com");
 message.setBody("Join me for a group chat!");
 message.addExtension(new GroupChatInvitation("room@chat.example.com"););
 con.sendPacket(message);
 
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...
 
Note: 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.

Author:
Matt Tucker

Nested Class Summary
static class GroupChatInvitation.Provider
           
 
Field Summary
static String ELEMENT_NAME
          Element name of the packet extension.
static String NAMESPACE
          Namespace of the packet extension.
 
Constructor Summary
GroupChatInvitation(String roomAddress)
          Creates a new group chat invitation to the specified room address.
 
Method Summary
 String getElementName()
          Returns the root element name.
 String getNamespace()
          Returns the root element XML namespace.
 String getRoomAddress()
          Returns the address of the group chat room.
 String toXML()
          Returns the XML reppresentation of the PacketExtension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_NAME

public static final String ELEMENT_NAME
Element name of the packet extension.

See Also:
Constant Field Values

NAMESPACE

public static final String NAMESPACE
Namespace of the packet extension.

See Also:
Constant Field Values
Constructor Detail

GroupChatInvitation

public GroupChatInvitation(String roomAddress)
Creates a new group chat invitation to the specified room address. GroupChat room addresses are in the form room@service, where service is the name of groupchat server, such as chat.example.com.

Parameters:
roomAddress - the address of the group chat room.
Method Detail

getRoomAddress

public String getRoomAddress()
Returns the address of the group chat room. GroupChat room addresses are in the form room@service, where service is the name of groupchat server, such as chat.example.com.

Returns:
the address of the group chat room.

getElementName

public String getElementName()
Description copied from interface: PacketExtension
Returns the root element name.

Specified by:
getElementName in interface PacketExtension
Returns:
the element name.

getNamespace

public String getNamespace()
Description copied from interface: PacketExtension
Returns the root element XML namespace.

Specified by:
getNamespace in interface PacketExtension
Returns:
the namespace.

toXML

public String toXML()
Description copied from interface: PacketExtension
Returns the XML reppresentation of the PacketExtension.

Specified by:
toXML in interface PacketExtension
Returns:
the packet extension as XML.

Smack

Copyright © 2003-2007 Jive Software.