Class GroupChatInvitation

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.XmlLangElement

    public class GroupChatInvitation
    extends java.lang.Object
    implements org.jivesoftware.smack.packet.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("[email protected]");
     message.setBody("Join me for a group chat!");
     message.addExtension(new GroupChatInvitation("[email protected]"););
     con.sendStanza(message);
     
    To listen for group chat invitations, use a StanzaExtensionFilter for the x element name and jabber: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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ELEMENT
      Element name of the stanza extension.
      static java.lang.String NAMESPACE
      Namespace of the stanza extension.
      static javax.xml.namespace.QName QNAME  
    • Constructor Summary

      Constructors 
      Constructor Description
      GroupChatInvitation​(java.lang.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​(org.jivesoftware.smack.packet.Stanza packet)
      Get the group chat invitation from the given stanza.
      java.lang.String getElementName()  
      java.lang.String getNamespace()  
      java.lang.String getRoomAddress()
      Returns the address of the group chat room.
      org.jivesoftware.smack.util.XmlStringBuilder toXML​(org.jivesoftware.smack.packet.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.Element

        toXML, toXML
      • Methods inherited from interface org.jivesoftware.smack.packet.XmlElement

        getLanguage, getQName
    • Field Detail

      • ELEMENT

        public static final java.lang.String ELEMENT
        Element name of the stanza extension.
        See Also:
        Constant Field Values
      • NAMESPACE

        public static final java.lang.String NAMESPACE
        Namespace of the stanza extension.
        See Also:
        Constant Field Values
      • QNAME

        public static final javax.xml.namespace.QName QNAME
    • Constructor Detail

      • GroupChatInvitation

        public GroupChatInvitation​(java.lang.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 group chat server, such as chat.example.com.
        Parameters:
        roomAddress - the address of the group chat room.
    • Method Detail

      • getRoomAddress

        public java.lang.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 group chat server, such as chat.example.com.
        Returns:
        the address of the group chat room.
      • getElementName

        public java.lang.String getElementName()
        Specified by:
        getElementName in interface org.jivesoftware.smack.packet.NamedElement
      • getNamespace

        public java.lang.String getNamespace()
        Specified by:
        getNamespace in interface org.jivesoftware.smack.packet.XmlElement
      • toXML

        public org.jivesoftware.smack.util.XmlStringBuilder toXML​(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
        Specified by:
        toXML in interface org.jivesoftware.smack.packet.Element
      • from

        public static GroupChatInvitation from​(org.jivesoftware.smack.packet.Stanza packet)
        Get the group chat invitation from the given stanza.
        Parameters:
        packet - TODO javadoc me please
        Returns:
        the GroupChatInvitation or null