Class MultiUserChat


  • public class MultiUserChat
    extends java.lang.Object
    A MultiUserChat room (XEP-45), created with MultiUserChatManager.getMultiUserChat(EntityBareJid).

    A MultiUserChat is a conversation that takes place among many users in a virtual room. A room could have many occupants with different affiliation and roles. Possible affiliations are "owner", "admin", "member", and "outcast". Possible roles are "moderator", "participant", and "visitor". Each role and affiliation guarantees different privileges (e.g. Send messages to all occupants, Kick participants and visitors, Grant voice, Edit member list, etc.).

    Note: Make sure to leave the MUC (leave()) when you don't need it anymore or otherwise you may leak the instance.

    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean addInvitationRejectionListener​(InvitationRejectionListener listener)
      Adds a listener to invitation rejections notifications.
      boolean addMessageInterceptor​(MucMessageInterceptor interceptor)  
      boolean addMessageListener​(org.jivesoftware.smack.MessageListener listener)
      Adds a stanza listener that will be notified of any new messages in the group chat.
      boolean addParticipantListener​(org.jivesoftware.smack.PresenceListener listener)
      Adds a stanza listener that will be notified of any new Presence packets sent to the group chat.
      boolean addParticipantStatusListener​(ParticipantStatusListener listener)
      Adds a listener that will be notified of changes in occupants status in the room such as the user being kicked, banned, or granted admin permissions.
      void addPresenceInterceptor​(org.jivesoftware.smack.util.Consumer<org.jivesoftware.smack.packet.PresenceBuilder> presenceInterceptor)
      Adds a new StanzaListener that will be invoked every time a new presence is going to be sent by this MultiUserChat to the server.
      boolean addSubjectUpdatedListener​(SubjectUpdatedListener listener)
      Adds a listener to subject change notifications.
      boolean addUserStatusListener​(UserStatusListener listener)
      Adds a listener that will be notified of changes in your status in the room such as the user being kicked, banned, or granted admin permissions.
      void banUser​(org.jxmpp.jid.Jid jid, java.lang.String reason)
      Bans a user from the room.
      void banUsers​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Bans users from the room.
      org.jivesoftware.smack.packet.MessageBuilder buildMessage()
      Constructs a new message builder for messages send to this MUC room.
      void changeAvailabilityStatus​(java.lang.String status, org.jivesoftware.smack.packet.Presence.Mode mode)
      Changes the occupant's availability status within the room.
      void changeNickname​(org.jxmpp.jid.parts.Resourcepart nickname)
      Changes the occupant's nickname to a new nickname within the room.
      void changeSubject​(java.lang.String subject)
      Changes the subject within the room.
      MultiUserChat.MucCreateConfigFormHandle create​(org.jxmpp.jid.parts.Resourcepart nickname)
      Creates the room according to some default configuration, assign the requesting user as the room owner, and add the owner to the room but not allow anyone else to enter the room (effectively "locking" the room).
      org.jivesoftware.smack.packet.Message createMessage()
      Deprecated.
      use buildMessage() instead.
      MultiUserChat.MucCreateConfigFormHandle createOrJoin​(MucEnterConfiguration mucEnterConfiguration)
      Like create(Resourcepart), but will return a MultiUserChat.MucCreateConfigFormHandle if the room creation was acknowledged by the service (with an 201 status code).
      MultiUserChat.MucCreateConfigFormHandle createOrJoin​(org.jxmpp.jid.parts.Resourcepart nickname)
      Create or join the MUC room with the given nickname.
      MultiUserChat.MucCreateConfigFormHandle createOrJoinIfNecessary​(org.jxmpp.jid.parts.Resourcepart nickname, java.lang.String password)
      Create or join a MUC if it is necessary, i.e.
      org.jivesoftware.smack.chat.Chat createPrivateChat​(org.jxmpp.jid.EntityFullJid occupant, org.jivesoftware.smack.chat.ChatMessageListener listener)
      Returns a new Chat for sending private messages to a given room occupant.
      void destroy()
      Sends a request to destroy the room.
      void destroy​(java.lang.String reason, org.jxmpp.jid.EntityBareJid alternateJID)
      Sends a request to the server to destroy the room.
      java.util.List<Affiliate> getAdmins()
      Returns a list of Affiliate with the room administrators.
      MucConfigFormManager getConfigFormManager()
      Get a MucConfigFormManager to configure this room.
      Form getConfigurationForm()
      Returns the room's configuration form that the room's owner can use.
      MucEnterConfiguration.Builder getEnterConfigurationBuilder​(org.jxmpp.jid.parts.Resourcepart nickname)
      Get a new MUC enter configuration builder.
      java.util.List<Affiliate> getMembers()
      Returns a list of Affiliate with the room members.
      java.util.List<Occupant> getModerators()
      Returns a list of Occupant with the room moderators.
      org.jxmpp.jid.EntityFullJid getMyRoomJid()
      Return the full JID of the user in the room, or null if the room is not joined.
      org.jxmpp.jid.parts.Resourcepart getNickname()
      Returns the nickname that was used to join the room, or null if not currently joined.
      Occupant getOccupant​(org.jxmpp.jid.EntityFullJid user)
      Returns the Occupant information for a particular occupant, or null if the user is not in the room.
      org.jivesoftware.smack.packet.Presence getOccupantPresence​(org.jxmpp.jid.EntityFullJid user)
      Returns the presence info for a particular user, or null if the user is not in the room.
      java.util.List<org.jxmpp.jid.EntityFullJid> getOccupants()
      Returns an List for the list of fully qualified occupants in the group chat.
      int getOccupantsCount()
      Returns the number of occupants in the group chat.
      java.util.List<Affiliate> getOutcasts()
      Returns a list of Affiliate with the room outcasts.
      java.util.List<Affiliate> getOwners()
      Returns a list of Affiliate with the room owners.
      java.util.List<Occupant> getParticipants()
      Returns a list of Occupant with the room participants.
      Form getRegistrationForm()
      Returns the room's registration form that an unaffiliated user, can use to become a member of the room or null if no registration is possible.
      java.lang.String getReservedNickname()
      Returns the reserved room nickname for the user in the room.
      org.jxmpp.jid.EntityBareJid getRoom()
      Returns the name of the room this MultiUserChat object represents.
      java.lang.String getSubject()
      Returns the last known room's subject or null if the user hasn't joined the room or the room does not have a subject yet.
      org.jivesoftware.smack.XMPPConnection getXmppConnection()
      Get the XMPP connection associated with this chat instance.
      void grantAdmin​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Grants administrator privileges to other users.
      void grantAdmin​(org.jxmpp.jid.Jid jid)
      Grants administrator privileges to another user.
      void grantMembership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Grants membership to other users.
      void grantMembership​(org.jxmpp.jid.Jid jid)
      Grants membership to a user.
      void grantModerator​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
      Grants moderator privileges to participants or visitors.
      void grantModerator​(org.jxmpp.jid.parts.Resourcepart nickname)
      Grants moderator privileges to a participant or visitor.
      void grantOwnership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Grants ownership privileges to other users.
      void grantOwnership​(org.jxmpp.jid.Jid jid)
      Grants ownership privileges to another user.
      void grantVoice​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
      Grants voice to visitors in the room.
      void grantVoice​(org.jxmpp.jid.parts.Resourcepart nickname)
      Grants voice to a visitor in the room.
      void invite​(org.jivesoftware.smack.packet.MessageBuilder messageBuilder, org.jxmpp.jid.EntityBareJid user, java.lang.String reason)
      Invites another user to the room in which one is an occupant using a given Message.
      void invite​(org.jivesoftware.smack.packet.Message message, org.jxmpp.jid.EntityBareJid user, java.lang.String reason)
      void invite​(org.jxmpp.jid.EntityBareJid user, java.lang.String reason)
      Invites another user to the room in which one is an occupant.
      void inviteDirectly​(org.jxmpp.jid.EntityBareJid address)
      Invites another user to the room in which one is an occupant.
      void inviteDirectly​(org.jxmpp.jid.EntityBareJid address, java.lang.String reason, java.lang.String password, boolean continueAsOneToOneChat, java.lang.String thread)
      Invites another user to the room in which one is an occupant.
      boolean isJoined()
      Returns true if currently in the multi user chat (after calling the join(Resourcepart) method).
      org.jivesoftware.smack.packet.Presence join​(MucEnterConfiguration mucEnterConfiguration)
      Joins the chat room using the specified nickname and password.
      org.jivesoftware.smack.packet.Presence join​(org.jxmpp.jid.parts.Resourcepart nickname)
      Joins the chat room using the specified nickname.
      void join​(org.jxmpp.jid.parts.Resourcepart nickname, java.lang.String password)
      Joins the chat room using the specified nickname and password.
      void kickParticipant​(org.jxmpp.jid.parts.Resourcepart nickname, java.lang.String reason)
      Kicks a visitor or participant from the room.
      org.jivesoftware.smack.packet.Presence leave()
      Leave the chat room.
      org.jivesoftware.smack.packet.Presence leaveSync()
      Deprecated.
      use leave() instead.
      org.jivesoftware.smack.packet.Message nextMessage()
      Returns the next available message in the chat.
      org.jivesoftware.smack.packet.Message nextMessage​(long timeout)
      Returns the next available message in the chat.
      org.jivesoftware.smack.packet.Message pollMessage()
      Polls for and returns the next message, or null if there isn't a message immediately available.
      boolean removeInvitationRejectionListener​(InvitationRejectionListener listener)
      Removes a listener from invitation rejections notifications.
      boolean removeMessageInterceptor​(MucMessageInterceptor interceptor)  
      boolean removeMessageListener​(org.jivesoftware.smack.MessageListener listener)
      Removes a stanza listener that was being notified of any new messages in the multi user chat.
      boolean removeParticipantListener​(org.jivesoftware.smack.PresenceListener listener)
      Removes a stanza listener that was being notified of any new Presence packets sent to the group chat.
      boolean removeParticipantStatusListener​(ParticipantStatusListener listener)
      Removes a listener that was being notified of changes in occupants status in the room such as the user being kicked, banned, or granted admin permissions.
      void removePresenceInterceptor​(org.jivesoftware.smack.util.Consumer<org.jivesoftware.smack.packet.PresenceBuilder> presenceInterceptor)
      Removes a StanzaListener that was being invoked every time a new presence was being sent by this MultiUserChat to the server.
      boolean removeSubjectUpdatedListener​(SubjectUpdatedListener listener)
      Removes a listener from subject change notifications.
      boolean removeUserStatusListener​(UserStatusListener listener)
      Removes a listener that was being notified of changes in your status in the room such as the user being kicked, banned, or granted admin permissions.
      void requestVoice()
      Sends a voice request to the MUC.
      void revokeAdmin​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Revokes administrator privileges from users.
      void revokeAdmin​(org.jxmpp.jid.EntityJid jid)
      Revokes administrator privileges from a user.
      void revokeMembership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Revokes users' membership.
      void revokeMembership​(org.jxmpp.jid.Jid jid)
      Revokes a user's membership.
      void revokeModerator​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
      Revokes moderator privileges from other users.
      void revokeModerator​(org.jxmpp.jid.parts.Resourcepart nickname)
      Revokes moderator privileges from another user.
      void revokeOwnership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
      Revokes ownership privileges from other users.
      void revokeOwnership​(org.jxmpp.jid.Jid jid)
      Revokes ownership privileges from another user.
      void revokeVoice​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
      Revokes voice from participants in the room.
      void revokeVoice​(org.jxmpp.jid.parts.Resourcepart nickname)
      Revokes voice from a participant in the room.
      void sendConfigurationForm​(FillableForm form)
      Sends the completed configuration form to the server.
      void sendMessage​(java.lang.String text)
      Sends a message to the chat room.
      void sendMessage​(org.jivesoftware.smack.packet.Message message)
      Deprecated.
      org.jivesoftware.smack.packet.MessageView sendMessage​(org.jivesoftware.smack.packet.MessageBuilder messageBuilder)
      Sends a Message to the chat room.
      void sendRegistrationForm​(FillableForm form)
      Sends the completed registration form to the server.
      boolean serviceSupportsStableIds()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getRoom

        public org.jxmpp.jid.EntityBareJid getRoom()
        Returns the name of the room this MultiUserChat object represents.
        Returns:
        the multi user chat room name.
      • getEnterConfigurationBuilder

        public MucEnterConfiguration.Builder getEnterConfigurationBuilder​(org.jxmpp.jid.parts.Resourcepart nickname)
        Get a new MUC enter configuration builder.
        Parameters:
        nickname - the nickname used when entering the MUC room.
        Returns:
        a new MUC enter configuration builder.
        Since:
        4.2
      • createOrJoinIfNecessary

        public MultiUserChat.MucCreateConfigFormHandle createOrJoinIfNecessary​(org.jxmpp.jid.parts.Resourcepart nickname,
                                                                               java.lang.String password)
                                                                        throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                                               org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                                               org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                               java.lang.InterruptedException,
                                                                               MultiUserChatException.NotAMucServiceException
        Create or join a MUC if it is necessary, i.e. if not the MUC is not already joined.
        Parameters:
        nickname - the required nickname to use.
        password - the optional password required to join
        Returns:
        A MultiUserChat.MucCreateConfigFormHandle if the room was created while joining, or null if the room was just joined.
        Throws:
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        MultiUserChatException.NotAMucServiceException - if the entity is not a MUC serivce.
      • join

        public org.jivesoftware.smack.packet.Presence join​(org.jxmpp.jid.parts.Resourcepart nickname)
                                                    throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                           org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                           org.jivesoftware.smack.SmackException.NotConnectedException,
                                                           java.lang.InterruptedException,
                                                           MultiUserChatException.NotAMucServiceException
        Joins the chat room using the specified nickname. If already joined using another nickname, this method will first leave the room and then re-join using the new nickname. The default connection timeout for a reply from the group chat server that the join succeeded will be used. After joining the room, the room will decide the amount of history to send.
        Parameters:
        nickname - the nickname to use.
        Returns:
        the leave self-presence as reflected by the MUC.
        Throws:
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs joining the room. In particular, a 401 error can occur if no password was provided and one is required; or a 403 error can occur if the user is banned; or a 404 error can occur if the room does not exist or is locked; or a 407 error can occur if user is not on the member list; or a 409 error can occur if someone is already in the group chat with the same nickname.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        MultiUserChatException.NotAMucServiceException - if the entity is not a MUC serivce.
      • join

        public void join​(org.jxmpp.jid.parts.Resourcepart nickname,
                         java.lang.String password)
                  throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                         java.lang.InterruptedException,
                         org.jivesoftware.smack.SmackException.NoResponseException,
                         org.jivesoftware.smack.SmackException.NotConnectedException,
                         MultiUserChatException.NotAMucServiceException
        Joins the chat room using the specified nickname and password. If already joined using another nickname, this method will first leave the room and then re-join using the new nickname. The default connection timeout for a reply from the group chat server that the join succeeded will be used. After joining the room, the room will decide the amount of history to send.

        A password is required when joining password protected rooms. If the room does not require a password there is no need to provide one.

        Parameters:
        nickname - the nickname to use.
        password - the password to use.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs joining the room. In particular, a 401 error can occur if no password was provided and one is required; or a 403 error can occur if the user is banned; or a 404 error can occur if the room does not exist or is locked; or a 407 error can occur if user is not on the member list; or a 409 error can occur if someone is already in the group chat with the same nickname.
        java.lang.InterruptedException - if the calling thread was interrupted.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        MultiUserChatException.NotAMucServiceException - if the entity is not a MUC serivce.
      • join

        public org.jivesoftware.smack.packet.Presence join​(MucEnterConfiguration mucEnterConfiguration)
                                                    throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                           org.jivesoftware.smack.SmackException.NoResponseException,
                                                           org.jivesoftware.smack.SmackException.NotConnectedException,
                                                           java.lang.InterruptedException,
                                                           MultiUserChatException.NotAMucServiceException
        Joins the chat room using the specified nickname and password. If already joined using another nickname, this method will first leave the room and then re-join using the new nickname.

        To control the amount of history to receive while joining a room you will need to provide a configured DiscussionHistory object.

        A password is required when joining password protected rooms. If the room does not require a password there is no need to provide one.

        If the room does not already exist when the user seeks to enter it, the server will decide to create a new room or not.

        Parameters:
        mucEnterConfiguration - the configuration used to enter the MUC.
        Returns:
        the join self-presence as reflected by the MUC.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs joining the room. In particular, a 401 error can occur if no password was provided and one is required; or a 403 error can occur if the user is banned; or a 404 error can occur if the room does not exist or is locked; or a 407 error can occur if user is not on the member list; or a 409 error can occur if someone is already in the group chat with the same nickname.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        MultiUserChatException.NotAMucServiceException - if the entity is not a MUC serivce.
      • isJoined

        public boolean isJoined()
        Returns true if currently in the multi user chat (after calling the join(Resourcepart) method).
        Returns:
        true if currently in the multi user chat room.
      • leaveSync

        @Deprecated
        public org.jivesoftware.smack.packet.Presence leaveSync()
                                                         throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                java.lang.InterruptedException,
                                                                MultiUserChatException.MucNotJoinedException,
                                                                org.jivesoftware.smack.SmackException.NoResponseException,
                                                                org.jivesoftware.smack.XMPPException.XMPPErrorException
        Deprecated.
        use leave() instead.
        Leave the chat room.
        Returns:
        the leave presence as reflected by the MUC.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
      • leave

        public org.jivesoftware.smack.packet.Presence leave()
                                                     throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                                            java.lang.InterruptedException,
                                                            org.jivesoftware.smack.SmackException.NoResponseException,
                                                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                            MultiUserChatException.MucNotJoinedException
        Leave the chat room.
        Returns:
        the leave presence as reflected by the MUC.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
      • getConfigFormManager

        public MucConfigFormManager getConfigFormManager()
                                                  throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                         org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                         org.jivesoftware.smack.SmackException.NotConnectedException,
                                                         java.lang.InterruptedException
        Get a MucConfigFormManager to configure this room.

        Only room owners are able to configure a room.

        Returns:
        a MUC configuration form manager for this room.
        Throws:
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        Since:
        4.2
        See Also:
        XEP-45 § 10.2 Subsequent Room Configuration
      • getConfigurationForm

        public Form getConfigurationForm()
                                  throws org.jivesoftware.smack.SmackException.NoResponseException,
                                         org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                         org.jivesoftware.smack.SmackException.NotConnectedException,
                                         java.lang.InterruptedException
        Returns the room's configuration form that the room's owner can use. The configuration form allows to set the room's language, enable logging, specify room's type, etc..
        Returns:
        the Form that contains the fields to complete together with the instrucions or null if no configuration is possible.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs asking the configuration form for the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendConfigurationForm

        public void sendConfigurationForm​(FillableForm form)
                                   throws org.jivesoftware.smack.SmackException.NoResponseException,
                                          org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                          org.jivesoftware.smack.SmackException.NotConnectedException,
                                          java.lang.InterruptedException
        Sends the completed configuration form to the server. The room will be configured with the new settings defined in the form.
        Parameters:
        form - the form with the new settings.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs setting the new rooms' configuration.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getRegistrationForm

        public Form getRegistrationForm()
                                 throws org.jivesoftware.smack.SmackException.NoResponseException,
                                        org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                        org.jivesoftware.smack.SmackException.NotConnectedException,
                                        java.lang.InterruptedException
        Returns the room's registration form that an unaffiliated user, can use to become a member of the room or null if no registration is possible. Some rooms may restrict the privilege to register members and allow only room admins to add new members.

        If the user requesting registration requirements is not allowed to register with the room (e.g. because that privilege has been restricted), the room will return a "Not Allowed" error to the user (error code 405).

        Returns:
        the registration Form that contains the fields to complete together with the instrucions or null if no registration is possible.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs asking the registration form for the room or a 405 error if the user is not allowed to register with the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendRegistrationForm

        public void sendRegistrationForm​(FillableForm form)
                                  throws org.jivesoftware.smack.SmackException.NoResponseException,
                                         org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                         org.jivesoftware.smack.SmackException.NotConnectedException,
                                         java.lang.InterruptedException
        Sends the completed registration form to the server. After the user successfully submits the form, the room may queue the request for review by the room admins or may immediately add the user to the member list by changing the user's affiliation from "none" to "member.

        If the desired room nickname is already reserved for that room, the room will return a "Conflict" error to the user (error code 409). If the room does not support registration, it will return a "Service Unavailable" error to the user (error code 503).

        Parameters:
        form - the completed registration form.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs submitting the registration form. In particular, a 409 error can occur if the desired room nickname is already reserved for that room; or a 503 error can occur if the room does not support registration.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • destroy

        public void destroy()
                     throws org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            java.lang.InterruptedException
        Sends a request to destroy the room.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs while trying to destroy the room. An error can occur which will be wrapped by an XMPPException -- XMPP error code 403. The error code can be used to present more appropriate error messages to end-users.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        Since:
        4.5
        See Also:
        destroy(String, EntityBareJid)
      • destroy

        public void destroy​(java.lang.String reason,
                            org.jxmpp.jid.EntityBareJid alternateJID)
                     throws org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            java.lang.InterruptedException
        Sends a request to the server to destroy the room. The sender of the request should be the room's owner. If the sender of the destroy request is not the room's owner then the server will answer a "Forbidden" error (403).
        Parameters:
        reason - an optional reason for the room destruction.
        alternateJID - an optional JID of an alternate location.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs while trying to destroy the room. An error can occur which will be wrapped by an XMPPException -- XMPP error code 403. The error code can be used to present more appropriate error messages to end-users.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • invite

        public void invite​(org.jxmpp.jid.EntityBareJid user,
                           java.lang.String reason)
                    throws org.jivesoftware.smack.SmackException.NotConnectedException,
                           java.lang.InterruptedException
        Invites another user to the room in which one is an occupant. The invitation will be sent to the room which in turn will forward the invitation to the invitee.

        If the room is password-protected, the invitee will receive a password to use to join the room. If the room is members-only, the invitee may be added to the member list.

        Parameters:
        user - the user to invite to the room.(e.g. [email protected])
        reason - the reason why the user is being invited.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • invite

        @Deprecated
        public void invite​(org.jivesoftware.smack.packet.Message message,
                           org.jxmpp.jid.EntityBareJid user,
                           java.lang.String reason)
                    throws org.jivesoftware.smack.SmackException.NotConnectedException,
                           java.lang.InterruptedException
        Invites another user to the room in which one is an occupant using a given Message. The invitation will be sent to the room which in turn will forward the invitation to the invitee.

        If the room is password-protected, the invitee will receive a password to use to join the room. If the room is members-only, the invitee may be added to the member list.

        Parameters:
        message - the message to use for sending the invitation.
        user - the user to invite to the room.(e.g. [email protected])
        reason - the reason why the user is being invited.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • invite

        public void invite​(org.jivesoftware.smack.packet.MessageBuilder messageBuilder,
                           org.jxmpp.jid.EntityBareJid user,
                           java.lang.String reason)
                    throws org.jivesoftware.smack.SmackException.NotConnectedException,
                           java.lang.InterruptedException
        Invites another user to the room in which one is an occupant using a given Message. The invitation will be sent to the room which in turn will forward the invitation to the invitee.

        If the room is password-protected, the invitee will receive a password to use to join the room. If the room is members-only, the invitee may be added to the member list.

        Parameters:
        messageBuilder - the message to use for sending the invitation.
        user - the user to invite to the room.(e.g. [email protected])
        reason - the reason why the user is being invited.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • inviteDirectly

        public void inviteDirectly​(org.jxmpp.jid.EntityBareJid address)
                            throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Invites another user to the room in which one is an occupant. In contrast to the method "invite", the invitation is sent directly to the user rather than via the chat room. This is useful when the user being invited is offline, as otherwise the invitation would be dropped.
        Parameters:
        address - the user to send the invitation to
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • inviteDirectly

        public void inviteDirectly​(org.jxmpp.jid.EntityBareJid address,
                                   java.lang.String reason,
                                   java.lang.String password,
                                   boolean continueAsOneToOneChat,
                                   java.lang.String thread)
                            throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Invites another user to the room in which one is an occupant. In contrast to the method "invite", the invitation is sent directly to the user rather than via the chat room. This is useful when the user being invited is offline, as otherwise the invitation would be dropped.
        Parameters:
        address - the user to send the invitation to
        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
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • addInvitationRejectionListener

        public boolean addInvitationRejectionListener​(InvitationRejectionListener listener)
        Adds a listener to invitation rejections notifications. The listener will be fired anytime an invitation is declined.
        Parameters:
        listener - an invitation rejection listener.
        Returns:
        true if the listener was not already added.
      • removeInvitationRejectionListener

        public boolean removeInvitationRejectionListener​(InvitationRejectionListener listener)
        Removes a listener from invitation rejections notifications. The listener will be fired anytime an invitation is declined.
        Parameters:
        listener - an invitation rejection listener.
        Returns:
        true if the listener was registered and is now removed.
      • addSubjectUpdatedListener

        public boolean addSubjectUpdatedListener​(SubjectUpdatedListener listener)
        Adds a listener to subject change notifications. The listener will be fired anytime the room's subject changes.
        Parameters:
        listener - a subject updated listener.
        Returns:
        true if the listener was not already added.
      • removeSubjectUpdatedListener

        public boolean removeSubjectUpdatedListener​(SubjectUpdatedListener listener)
        Removes a listener from subject change notifications. The listener will be fired anytime the room's subject changes.
        Parameters:
        listener - a subject updated listener.
        Returns:
        true if the listener was registered and is now removed.
      • addPresenceInterceptor

        public void addPresenceInterceptor​(org.jivesoftware.smack.util.Consumer<org.jivesoftware.smack.packet.PresenceBuilder> presenceInterceptor)
        Adds a new StanzaListener that will be invoked every time a new presence is going to be sent by this MultiUserChat to the server. Stanza interceptors may add new extensions to the presence that is going to be sent to the MUC service.
        Parameters:
        presenceInterceptor - the new stanza interceptor that will intercept presence packets.
      • removePresenceInterceptor

        public void removePresenceInterceptor​(org.jivesoftware.smack.util.Consumer<org.jivesoftware.smack.packet.PresenceBuilder> presenceInterceptor)
        Removes a StanzaListener that was being invoked every time a new presence was being sent by this MultiUserChat to the server. Stanza interceptors may add new extensions to the presence that is going to be sent to the MUC service.
        Parameters:
        presenceInterceptor - the stanza interceptor to remove.
      • getSubject

        public java.lang.String getSubject()
        Returns the last known room's subject or null if the user hasn't joined the room or the room does not have a subject yet. In case the room has a subject, as soon as the user joins the room a message with the current room's subject will be received.

        To be notified every time the room's subject change you should add a listener to this room. addSubjectUpdatedListener(SubjectUpdatedListener)

        To change the room's subject use changeSubject(String).

        Returns:
        the room's subject or null if the user hasn't joined the room or the room does not have a subject yet.
      • getReservedNickname

        public java.lang.String getReservedNickname()
                                             throws org.jivesoftware.smack.SmackException,
                                                    java.lang.InterruptedException
        Returns the reserved room nickname for the user in the room. A user may have a reserved nickname, for example through explicit room registration or database integration. In such cases it may be desirable for the user to discover the reserved nickname before attempting to enter the room.
        Returns:
        the reserved room nickname or null if none.
        Throws:
        org.jivesoftware.smack.SmackException - if there was no response from the server.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getNickname

        public org.jxmpp.jid.parts.Resourcepart getNickname()
        Returns the nickname that was used to join the room, or null if not currently joined.
        Returns:
        the nickname currently being used.
      • getMyRoomJid

        public org.jxmpp.jid.EntityFullJid getMyRoomJid()
        Return the full JID of the user in the room, or null if the room is not joined.
        Returns:
        the full JID of the user in the room, or null.
        Since:
        4.5.0
      • changeNickname

        public void changeNickname​(org.jxmpp.jid.parts.Resourcepart nickname)
                            throws org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException,
                                   MultiUserChatException.MucNotJoinedException
        Changes the occupant's nickname to a new nickname within the room. Each room occupant will receive two presence packets. One of type "unavailable" for the old nickname and one indicating availability for the new nickname. The unavailable presence will contain the new nickname and an appropriate status code (namely 303) as extended presence information. The status code 303 indicates that the occupant is changing his/her nickname.
        Parameters:
        nickname - the new nickname within the room.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if the new nickname is already in use by another occupant.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
      • changeAvailabilityStatus

        public void changeAvailabilityStatus​(java.lang.String status,
                                             org.jivesoftware.smack.packet.Presence.Mode mode)
                                      throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                             java.lang.InterruptedException,
                                             MultiUserChatException.MucNotJoinedException
        Changes the occupant's availability status within the room. The presence type will remain available but with a new status that describes the presence update and a new presence mode (e.g. Extended away).
        Parameters:
        status - a text message describing the presence update.
        mode - the mode type for the presence update.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
      • kickParticipant

        public void kickParticipant​(org.jxmpp.jid.parts.Resourcepart nickname,
                                    java.lang.String reason)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Kicks a visitor or participant from the room. The kicked occupant will receive a presence of type "unavailable" including a status code 307 and optionally along with the reason (if provided) and the bare JID of the user who initiated the kick. After the occupant was kicked from the room, the rest of the occupants will receive a presence of type "unavailable". The presence will include a status code 307 which means that the occupant was kicked from the room.
        Parameters:
        nickname - the nickname of the participant or visitor to kick from the room (e.g. "john").
        reason - the reason why the participant or visitor is being kicked from the room.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs kicking the occupant. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was intended to be kicked (i.e. Not Allowed error); or a 403 error can occur if the occupant that intended to kick another occupant does not have kicking privileges (i.e. Forbidden error); or a 400 error can occur if the provided nickname is not present in the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • requestVoice

        public void requestVoice()
                          throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                 java.lang.InterruptedException
        Sends a voice request to the MUC. The room moderators usually need to approve this request.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        Since:
        4.1
        See Also:
        XEP-45 § 7.13 Requesting Voice
      • grantVoice

        public void grantVoice​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
                        throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                               org.jivesoftware.smack.SmackException.NoResponseException,
                               org.jivesoftware.smack.SmackException.NotConnectedException,
                               java.lang.InterruptedException
        Grants voice to visitors in the room. In a moderated room, a moderator may want to manage who does and does not have "voice" in the room. To have voice means that a room occupant is able to send messages to the room occupants.
        Parameters:
        nicknames - the nicknames of the visitors to grant voice in the room (e.g. "john").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting voice to a visitor. In particular, a 403 error can occur if the occupant that intended to grant voice is not a moderator in this room (i.e. Forbidden error); or a 400 error can occur if the provided nickname is not present in the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantVoice

        public void grantVoice​(org.jxmpp.jid.parts.Resourcepart nickname)
                        throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                               org.jivesoftware.smack.SmackException.NoResponseException,
                               org.jivesoftware.smack.SmackException.NotConnectedException,
                               java.lang.InterruptedException
        Grants voice to a visitor in the room. In a moderated room, a moderator may want to manage who does and does not have "voice" in the room. To have voice means that a room occupant is able to send messages to the room occupants.
        Parameters:
        nickname - the nickname of the visitor to grant voice in the room (e.g. "john").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting voice to a visitor. In particular, a 403 error can occur if the occupant that intended to grant voice is not a moderator in this room (i.e. Forbidden error); or a 400 error can occur if the provided nickname is not present in the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeVoice

        public void revokeVoice​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
                         throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                org.jivesoftware.smack.SmackException.NoResponseException,
                                org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Revokes voice from participants in the room. In a moderated room, a moderator may want to revoke an occupant's privileges to speak. To have voice means that a room occupant is able to send messages to the room occupants.
        Parameters:
        nicknames - the nicknames of the participants to revoke voice (e.g. "john").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking voice from a participant. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was tried to revoke his voice (i.e. Not Allowed error); or a 400 error can occur if the provided nickname is not present in the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeVoice

        public void revokeVoice​(org.jxmpp.jid.parts.Resourcepart nickname)
                         throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                org.jivesoftware.smack.SmackException.NoResponseException,
                                org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Revokes voice from a participant in the room. In a moderated room, a moderator may want to revoke an occupant's privileges to speak. To have voice means that a room occupant is able to send messages to the room occupants.
        Parameters:
        nickname - the nickname of the participant to revoke voice (e.g. "john").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking voice from a participant. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was tried to revoke his voice (i.e. Not Allowed error); or a 400 error can occur if the provided nickname is not present in the room.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • banUsers

        public void banUsers​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                      throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                             org.jivesoftware.smack.SmackException.NoResponseException,
                             org.jivesoftware.smack.SmackException.NotConnectedException,
                             java.lang.InterruptedException
        Bans users from the room. An admin or owner of the room can ban users from a room. This means that the banned user will no longer be able to join the room unless the ban has been removed. If the banned user was present in the room then he/she will be removed from the room and notified that he/she was banned along with the reason (if provided) and the bare XMPP user ID of the user who initiated the ban.
        Parameters:
        jids - the bare XMPP user IDs of the users to ban.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs banning a user. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was tried to be banned (i.e. Not Allowed error).
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • banUser

        public void banUser​(org.jxmpp.jid.Jid jid,
                            java.lang.String reason)
                     throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.SmackException.NotConnectedException,
                            java.lang.InterruptedException
        Bans a user from the room. An admin or owner of the room can ban users from a room. This means that the banned user will no longer be able to join the room unless the ban has been removed. If the banned user was present in the room then he/she will be removed from the room and notified that he/she was banned along with the reason (if provided) and the bare XMPP user ID of the user who initiated the ban.
        Parameters:
        jid - the bare XMPP user ID of the user to ban (e.g. "[email protected]").
        reason - the optional reason why the user was banned.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs banning a user. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was tried to be banned (i.e. Not Allowed error).
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantMembership

        public void grantMembership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Grants membership to other users. Only administrators are able to grant membership. A user that becomes a room member will be able to enter a room of type Members-Only (i.e. a room that a user cannot enter without being on the member list).
        Parameters:
        jids - the XMPP user IDs of the users to grant membership.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting membership to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantMembership

        public void grantMembership​(org.jxmpp.jid.Jid jid)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Grants membership to a user. Only administrators are able to grant membership. A user that becomes a room member will be able to enter a room of type Members-Only (i.e. a room that a user cannot enter without being on the member list).
        Parameters:
        jid - the XMPP user ID of the user to grant membership (e.g. "[email protected]").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting membership to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeMembership

        public void revokeMembership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                              throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                     org.jivesoftware.smack.SmackException.NoResponseException,
                                     org.jivesoftware.smack.SmackException.NotConnectedException,
                                     java.lang.InterruptedException
        Revokes users' membership. Only administrators are able to revoke membership. A user that becomes a room member will be able to enter a room of type Members-Only (i.e. a room that a user cannot enter without being on the member list). If the user is in the room and the room is of type members-only then the user will be removed from the room.
        Parameters:
        jids - the bare XMPP user IDs of the users to revoke membership.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking membership to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeMembership

        public void revokeMembership​(org.jxmpp.jid.Jid jid)
                              throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                     org.jivesoftware.smack.SmackException.NoResponseException,
                                     org.jivesoftware.smack.SmackException.NotConnectedException,
                                     java.lang.InterruptedException
        Revokes a user's membership. Only administrators are able to revoke membership. A user that becomes a room member will be able to enter a room of type Members-Only (i.e. a room that a user cannot enter without being on the member list). If the user is in the room and the room is of type members-only then the user will be removed from the room.
        Parameters:
        jid - the bare XMPP user ID of the user to revoke membership (e.g. "[email protected]").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking membership to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantModerator

        public void grantModerator​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
                            throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Grants moderator privileges to participants or visitors. Room administrators may grant moderator privileges. A moderator is allowed to kick users, grant and revoke voice, invite other users, modify room's subject plus all the partcipants privileges.
        Parameters:
        nicknames - the nicknames of the occupants to grant moderator privileges.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting moderator privileges to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantModerator

        public void grantModerator​(org.jxmpp.jid.parts.Resourcepart nickname)
                            throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Grants moderator privileges to a participant or visitor. Room administrators may grant moderator privileges. A moderator is allowed to kick users, grant and revoke voice, invite other users, modify room's subject plus all the partcipants privileges.
        Parameters:
        nickname - the nickname of the occupant to grant moderator privileges.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting moderator privileges to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeModerator

        public void revokeModerator​(java.util.Collection<org.jxmpp.jid.parts.Resourcepart> nicknames)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Revokes moderator privileges from other users. The occupant that loses moderator privileges will become a participant. Room administrators may revoke moderator privileges only to occupants whose affiliation is member or none. This means that an administrator is not allowed to revoke moderator privileges from other room administrators or owners.
        Parameters:
        nicknames - the nicknames of the occupants to revoke moderator privileges.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking moderator privileges from a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeModerator

        public void revokeModerator​(org.jxmpp.jid.parts.Resourcepart nickname)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Revokes moderator privileges from another user. The occupant that loses moderator privileges will become a participant. Room administrators may revoke moderator privileges only to occupants whose affiliation is member or none. This means that an administrator is not allowed to revoke moderator privileges from other room administrators or owners.
        Parameters:
        nickname - the nickname of the occupant to revoke moderator privileges.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking moderator privileges from a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantOwnership

        public void grantOwnership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                            throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Grants ownership privileges to other users. Room owners may grant ownership privileges. Some room implementations will not allow to grant ownership privileges to other users. An owner is allowed to change defining room features as well as perform all administrative functions.
        Parameters:
        jids - the collection of bare XMPP user IDs of the users to grant ownership.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting ownership privileges to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantOwnership

        public void grantOwnership​(org.jxmpp.jid.Jid jid)
                            throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Grants ownership privileges to another user. Room owners may grant ownership privileges. Some room implementations will not allow to grant ownership privileges to other users. An owner is allowed to change defining room features as well as perform all administrative functions.
        Parameters:
        jid - the bare XMPP user ID of the user to grant ownership (e.g. "[email protected]").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting ownership privileges to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeOwnership

        public void revokeOwnership​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Revokes ownership privileges from other users. The occupant that loses ownership privileges will become an administrator. Room owners may revoke ownership privileges. Some room implementations will not allow to grant ownership privileges to other users.
        Parameters:
        jids - the bare XMPP user IDs of the users to revoke ownership.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking ownership privileges from a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeOwnership

        public void revokeOwnership​(org.jxmpp.jid.Jid jid)
                             throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Revokes ownership privileges from another user. The occupant that loses ownership privileges will become an administrator. Room owners may revoke ownership privileges. Some room implementations will not allow to grant ownership privileges to other users.
        Parameters:
        jid - the bare XMPP user ID of the user to revoke ownership (e.g. "[email protected]").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking ownership privileges from a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantAdmin

        public void grantAdmin​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                        throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                               org.jivesoftware.smack.SmackException.NoResponseException,
                               org.jivesoftware.smack.SmackException.NotConnectedException,
                               java.lang.InterruptedException
        Grants administrator privileges to other users. Room owners may grant administrator privileges to a member or unaffiliated user. An administrator is allowed to perform administrative functions such as banning users and edit moderator list.
        Parameters:
        jids - the bare XMPP user IDs of the users to grant administrator privileges.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting administrator privileges to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • grantAdmin

        public void grantAdmin​(org.jxmpp.jid.Jid jid)
                        throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                               org.jivesoftware.smack.SmackException.NoResponseException,
                               org.jivesoftware.smack.SmackException.NotConnectedException,
                               java.lang.InterruptedException
        Grants administrator privileges to another user. Room owners may grant administrator privileges to a member or unaffiliated user. An administrator is allowed to perform administrative functions such as banning users and edit moderator list.
        Parameters:
        jid - the bare XMPP user ID of the user to grant administrator privileges (e.g. "[email protected]").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs granting administrator privileges to a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeAdmin

        public void revokeAdmin​(java.util.Collection<? extends org.jxmpp.jid.Jid> jids)
                         throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                org.jivesoftware.smack.SmackException.NoResponseException,
                                org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Revokes administrator privileges from users. The occupant that loses administrator privileges will become a member. Room owners may revoke administrator privileges from a member or unaffiliated user.
        Parameters:
        jids - the bare XMPP user IDs of the user to revoke administrator privileges.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking administrator privileges from a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • revokeAdmin

        public void revokeAdmin​(org.jxmpp.jid.EntityJid jid)
                         throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                org.jivesoftware.smack.SmackException.NoResponseException,
                                org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Revokes administrator privileges from a user. The occupant that loses administrator privileges will become a member. Room owners may revoke administrator privileges from a member or unaffiliated user.
        Parameters:
        jid - the bare XMPP user ID of the user to revoke administrator privileges (e.g. "[email protected]").
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if an error occurs revoking administrator privileges from a user.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getOccupantsCount

        public int getOccupantsCount()
        Returns the number of occupants in the group chat.

        Note: this value will only be accurate after joining the group chat, and may fluctuate over time. If you query this value directly after joining the group chat it may not be accurate, as it takes a certain amount of time for the server to send all presence packets to this client.

        Returns:
        the number of occupants in the group chat.
      • getOccupants

        public java.util.List<org.jxmpp.jid.EntityFullJid> getOccupants()
        Returns an List for the list of fully qualified occupants in the group chat. For example, "[email protected]/SomeUser". Typically, a client would only display the nickname of the occupant. To get the nickname from the fully qualified name, use the XmppStringUtils.parseResource(String) method. Note: this value will only be accurate after joining the group chat, and may fluctuate over time.
        Returns:
        a List of the occupants in the group chat.
      • getOccupantPresence

        public org.jivesoftware.smack.packet.Presence getOccupantPresence​(org.jxmpp.jid.EntityFullJid user)
        Returns the presence info for a particular user, or null if the user is not in the room.

        Parameters:
        user - the room occupant to search for his presence. The format of user must be: roomName@service/nickname (e.g. [email protected]/thirdwitch).
        Returns:
        the occupant's current presence, or null if the user is unavailable or if no presence information is available.
      • getOccupant

        public Occupant getOccupant​(org.jxmpp.jid.EntityFullJid user)
        Returns the Occupant information for a particular occupant, or null if the user is not in the room. The Occupant object may include information such as full JID of the user as well as the role and affiliation of the user in the room.

        Parameters:
        user - the room occupant to search for his presence. The format of user must be: roomName@service/nickname (e.g. [email protected]/thirdwitch).
        Returns:
        the Occupant or null if the user is unavailable (i.e. not in the room).
      • addParticipantListener

        public boolean addParticipantListener​(org.jivesoftware.smack.PresenceListener listener)
        Adds a stanza listener that will be notified of any new Presence packets sent to the group chat. Using a listener is a suitable way to know when the list of occupants should be re-loaded due to any changes.
        Parameters:
        listener - a stanza listener that will be notified of any presence packets sent to the group chat.
        Returns:
        true if the listener was not already added.
      • removeParticipantListener

        public boolean removeParticipantListener​(org.jivesoftware.smack.PresenceListener listener)
        Removes a stanza listener that was being notified of any new Presence packets sent to the group chat.
        Parameters:
        listener - a stanza listener that was being notified of any presence packets sent to the group chat.
        Returns:
        true if the listener was removed, otherwise the listener was not added previously.
      • getOwners

        public java.util.List<Affiliate> getOwners()
                                            throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                   org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                                   java.lang.InterruptedException
        Returns a list of Affiliate with the room owners.
        Returns:
        a list of Affiliate with the room owners.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if you don't have enough privileges to get this information.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getAdmins

        public java.util.List<Affiliate> getAdmins()
                                            throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                   org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                                   java.lang.InterruptedException
        Returns a list of Affiliate with the room administrators.
        Returns:
        a list of Affiliate with the room administrators.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if you don't have enough privileges to get this information.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getMembers

        public java.util.List<Affiliate> getMembers()
                                             throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                    org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                                    java.lang.InterruptedException
        Returns a list of Affiliate with the room members.
        Returns:
        a list of Affiliate with the room members.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if you don't have enough privileges to get this information.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getOutcasts

        public java.util.List<Affiliate> getOutcasts()
                                              throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                     org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                     org.jivesoftware.smack.SmackException.NotConnectedException,
                                                     java.lang.InterruptedException
        Returns a list of Affiliate with the room outcasts.
        Returns:
        a list of Affiliate with the room outcasts.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if you don't have enough privileges to get this information.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getModerators

        public java.util.List<Occupant> getModerators()
                                               throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                      org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                      org.jivesoftware.smack.SmackException.NotConnectedException,
                                                      java.lang.InterruptedException
        Returns a list of Occupant with the room moderators.
        Returns:
        a list of Occupant with the room moderators.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if you don't have enough privileges to get this information.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getParticipants

        public java.util.List<Occupant> getParticipants()
                                                 throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                        org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                        org.jivesoftware.smack.SmackException.NotConnectedException,
                                                        java.lang.InterruptedException
        Returns a list of Occupant with the room participants.
        Returns:
        a list of Occupant with the room participants.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if you don't have enough privileges to get this information.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendMessage

        public void sendMessage​(java.lang.String text)
                         throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Sends a message to the chat room.
        Parameters:
        text - the text of the message to send.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • createPrivateChat

        public org.jivesoftware.smack.chat.Chat createPrivateChat​(org.jxmpp.jid.EntityFullJid occupant,
                                                                  org.jivesoftware.smack.chat.ChatMessageListener listener)
        Returns a new Chat for sending private messages to a given room occupant. The Chat's occupant address is the room's JID (i.e. roomName@service/nick). The server service will change the 'from' address to the sender's room JID and delivering the message to the intended recipient's full JID.
        Parameters:
        occupant - occupant unique room JID (e.g. '[email protected]/Paul').
        listener - the listener is a message listener that will handle messages for the newly created chat.
        Returns:
        new Chat for sending private messages to a given room occupant.
      • createMessage

        @Deprecated
        public org.jivesoftware.smack.packet.Message createMessage()
        Deprecated.
        use buildMessage() instead.
        Creates a new Message to send to the chat room.
        Returns:
        a new Message addressed to the chat room.
      • buildMessage

        public org.jivesoftware.smack.packet.MessageBuilder buildMessage()
        Constructs a new message builder for messages send to this MUC room.
        Returns:
        a new message builder.
      • sendMessage

        @Deprecated
        public void sendMessage​(org.jivesoftware.smack.packet.Message message)
                         throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Deprecated.
        Sends a Message to the chat room.
        Parameters:
        message - the message.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendMessage

        public org.jivesoftware.smack.packet.MessageView sendMessage​(org.jivesoftware.smack.packet.MessageBuilder messageBuilder)
                                                              throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                     java.lang.InterruptedException
        Sends a Message to the chat room.
        Parameters:
        messageBuilder - the message.
        Returns:
        a read-only view of the send message.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • pollMessage

        public org.jivesoftware.smack.packet.Message pollMessage()
                                                          throws MultiUserChatException.MucNotJoinedException
        Polls for and returns the next message, or null if there isn't a message immediately available. This method provides significantly different functionalty than the nextMessage() method since it's non-blocking. In other words, the method call will always return immediately, whereas the nextMessage method will return only when a message is available (or after a specific timeout).
        Returns:
        the next message if one is immediately available and null otherwise.
        Throws:
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
      • nextMessage

        public org.jivesoftware.smack.packet.Message nextMessage()
                                                          throws MultiUserChatException.MucNotJoinedException,
                                                                 java.lang.InterruptedException
        Returns the next available message in the chat. The method call will block (not return) until a message is available.
        Returns:
        the next message.
        Throws:
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • nextMessage

        public org.jivesoftware.smack.packet.Message nextMessage​(long timeout)
                                                          throws MultiUserChatException.MucNotJoinedException,
                                                                 java.lang.InterruptedException
        Returns the next available message in the chat. The method call will block (not return) until a stanza is available or the timeout has elapased. If the timeout elapses without a result, null will be returned.
        Parameters:
        timeout - the maximum amount of time to wait for the next message.
        Returns:
        the next message, or null if the timeout elapses without a message becoming available.
        Throws:
        MultiUserChatException.MucNotJoinedException - if not joined to the Multi-User Chat.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • addMessageListener

        public boolean addMessageListener​(org.jivesoftware.smack.MessageListener listener)
        Adds a stanza listener that will be notified of any new messages in the group chat. Only "group chat" messages addressed to this group chat will be delivered to the listener. If you wish to listen for other packets that may be associated with this group chat, you should register a PacketListener directly with the XMPPConnection with the appropriate PacketListener.
        Parameters:
        listener - a stanza listener.
        Returns:
        true if the listener was not already added.
      • removeMessageListener

        public boolean removeMessageListener​(org.jivesoftware.smack.MessageListener listener)
        Removes a stanza listener that was being notified of any new messages in the multi user chat. Only "group chat" messages addressed to this multi user chat were being delivered to the listener.
        Parameters:
        listener - a stanza listener.
        Returns:
        true if the listener was removed, otherwise the listener was not added previously.
      • removeMessageInterceptor

        public boolean removeMessageInterceptor​(MucMessageInterceptor interceptor)
      • changeSubject

        public void changeSubject​(java.lang.String subject)
                           throws org.jivesoftware.smack.SmackException.NoResponseException,
                                  org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                  org.jivesoftware.smack.SmackException.NotConnectedException,
                                  java.lang.InterruptedException
        Changes the subject within the room. As a default, only users with a role of "moderator" are allowed to change the subject in a room. Although some rooms may be configured to allow a mere participant or even a visitor to change the subject.
        Parameters:
        subject - the new room's subject to set.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if someone without appropriate privileges attempts to change the room subject will throw an error with code 403 (i.e. Forbidden)
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • addUserStatusListener

        public boolean addUserStatusListener​(UserStatusListener listener)
        Adds a listener that will be notified of changes in your status in the room such as the user being kicked, banned, or granted admin permissions.
        Parameters:
        listener - a user status listener.
        Returns:
        true if the user status listener was not already added.
      • removeUserStatusListener

        public boolean removeUserStatusListener​(UserStatusListener listener)
        Removes a listener that was being notified of changes in your status in the room such as the user being kicked, banned, or granted admin permissions.
        Parameters:
        listener - a user status listener.
        Returns:
        true if the listener was registered and is now removed.
      • addParticipantStatusListener

        public boolean addParticipantStatusListener​(ParticipantStatusListener listener)
        Adds a listener that will be notified of changes in occupants status in the room such as the user being kicked, banned, or granted admin permissions.
        Parameters:
        listener - a participant status listener.
        Returns:
        true if the listener was not already added.
      • removeParticipantStatusListener

        public boolean removeParticipantStatusListener​(ParticipantStatusListener listener)
        Removes a listener that was being notified of changes in occupants status in the room such as the user being kicked, banned, or granted admin permissions.
        Parameters:
        listener - a participant status listener.
        Returns:
        true if the listener was registered and is now removed.
      • getXmppConnection

        public org.jivesoftware.smack.XMPPConnection getXmppConnection()
        Get the XMPP connection associated with this chat instance.
        Returns:
        the associated XMPP connection.
        Since:
        4.3.0
      • serviceSupportsStableIds

        public boolean serviceSupportsStableIds()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object