Class GroupChatInvitation

  • All Implemented Interfaces:
    Element, ExtensionElement, NamedElement, XmlElement, 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 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.
    • Constructor Detail

      • GroupChatInvitation

        public GroupChatInvitation​(EntityBareJid 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.
      • GroupChatInvitation

        public GroupChatInvitation​(EntityBareJid roomAddress,
                                   String reason,
                                   String password,
                                   boolean continueAsOneToOneChat,
                                   String thread)
        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.
        reason - the purpose for the invitation
        password - specifies a password needed for entry
        continueAsOneToOneChat - specifies if the groupchat room continues a one-to-one chat having the designated thread
        thread - the thread to continue
    • Method Detail

      • getReason

        public String getReason()
        Returns the purpose for the invitation.
        Returns:
        the address of the group chat room.
      • getPassword

        public String getPassword()
        Returns the password needed for entry.
        Returns:
        the password needed for entry
      • getThread

        public String getThread()
        Returns the thread to continue.
        Returns:
        the thread to continue.
      • continueAsOneToOneChat

        public boolean continueAsOneToOneChat()
        Returns whether the groupchat room continues a one-to-one chat.
        Returns:
        whether the groupchat room continues a one-to-one chat.
      • getRoomAddress

        public EntityBareJid 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.
      • 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