Class GroupChatInvitation
- java.lang.Object
-
- org.jivesoftware.smackx.muc.packet.GroupChatInvitation
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class GroupChatInvitation extends Object implements ExtensionElement
A group chat invitation stanza 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.sendStanza(message);
To listen for group chat invitations, use a StanzaExtensionFilter for thex
element name andjabber:x:conference
namespace, as in the following code example:PacketFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference"); // Create a stanza collector or stanza listeners using the filter...
Note: this protocol is outdated now that the Multi-User Chat (MUC) XEP is available (XEP-45). However, most existing clients still use this older protocol. Once MUC support becomes more widespread, this API may be deprecated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GroupChatInvitation.Provider
-
Constructor Summary
Constructors Constructor Description GroupChatInvitation(String roomAddress)
Creates a new group chat invitation to the specified room address.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GroupChatInvitation
from(Stanza packet)
Get the group chat invitation from the given stanza.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.XmlStringBuilder
toXML(XmlEnvironment enclosingNamespace)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement
getLanguage, getQName
-
-
-
-
Field Detail
-
ELEMENT
public static final String ELEMENT
Element name of the stanza extension.- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
Namespace of the stanza 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 formroom@service
, whereservice
is the name of group chat server, such aschat.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 formroom@service
, whereservice
is the name of group chat server, such aschat.example.com
.- Returns:
- the address of the group chat room.
-
getElementName
public String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
getNamespace
public String getNamespace()
Description copied from interface:FullyQualifiedElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceFullyQualifiedElement
- Returns:
- the namespace.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
from
public static GroupChatInvitation from(Stanza packet)
Get the group chat invitation from the given stanza.- Parameters:
packet
- TODO javadoc me please- Returns:
- the GroupChatInvitation or null
-
-