Class MultiUserChatManager

    • Method Detail

      • getInstanceFor

        public static MultiUserChatManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
        Get a instance of a multi user chat manager for the given connection.
        Parameters:
        connection - TODO javadoc me please
        Returns:
        a multi user chat manager.
      • getMultiUserChat

        public MultiUserChat getMultiUserChat​(org.jxmpp.jid.EntityBareJid jid)
        Creates a multi user chat. Note: no information is sent to or received from the server until you attempt to join the chat room. On some server implementations, the room will not be created until the first person joins it.

        Most XMPP servers use a sub-domain for the chat service (eg chat.example.com for the XMPP server example.com). You must ensure that the room address you're trying to connect to includes the proper chat sub-domain.

        Parameters:
        jid - the name of the room in the form "roomName@service", where "service" is the hostname at which the multi-user chat service is running. Make sure to provide a valid JID.
        Returns:
        MultiUserChat instance of the room with the given jid.
      • addDefaultMessageInterceptor

        public static boolean addDefaultMessageInterceptor​(MucMessageInterceptor messageInterceptor)
      • removeDefaultMessageInterceptor

        public static boolean removeDefaultMessageInterceptor​(MucMessageInterceptor messageInterceptor)
      • isServiceEnabled

        public boolean isServiceEnabled​(org.jxmpp.jid.Jid user)
                                 throws org.jivesoftware.smack.SmackException.NoResponseException,
                                        org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                        org.jivesoftware.smack.SmackException.NotConnectedException,
                                        java.lang.InterruptedException
        Returns true if the specified user supports the Multi-User Chat protocol.
        Parameters:
        user - the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.
        Returns:
        a boolean indicating whether the specified user supports the MUC protocol.
        Throws:
        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.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getJoinedRooms

        public java.util.Set<org.jxmpp.jid.EntityBareJid> getJoinedRooms()
        Returns a Set of the rooms where the user has joined. The Iterator will contain Strings where each String represents a room (e.g. room@muc.jabber.org). Note: In order to get a list of bookmarked (but not necessarily joined) conferences, use BookmarkManager.getBookmarkedConferences().
        Returns:
        a List of the rooms where the user has joined using a given connection.
      • getJoinedRooms

        public java.util.List<org.jxmpp.jid.EntityBareJid> getJoinedRooms​(org.jxmpp.jid.EntityFullJid user)
                                                                   throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                                          org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                                          org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                          java.lang.InterruptedException
        Returns a List of the rooms where the requested user has joined. The Iterator will contain Strings where each String represents a room (e.g. room@muc.jabber.org).
        Parameters:
        user - the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.
        Returns:
        a List of the rooms where the requested user has joined.
        Throws:
        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.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getRoomInfo

        public RoomInfo getRoomInfo​(org.jxmpp.jid.EntityBareJid room)
                             throws org.jivesoftware.smack.SmackException.NoResponseException,
                                    org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                    org.jivesoftware.smack.SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Returns the discovered information of a given room without actually having to join the room. The server will provide information only for rooms that are public.
        Parameters:
        room - the name of the room in the form "roomName@service" of which we want to discover its information.
        Returns:
        the discovered information of a given room without actually having to join the room.
        Throws:
        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.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getMucServiceDomains

        public java.util.List<org.jxmpp.jid.DomainBareJid> getMucServiceDomains()
                                                                         throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                                                org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                                                org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                                java.lang.InterruptedException
        Returns a collection with the XMPP addresses of the Multi-User Chat services.
        Returns:
        a collection with the XMPP addresses of the Multi-User Chat services.
        Throws:
        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.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • getXMPPServiceDomains

        @Deprecated
        public java.util.List<org.jxmpp.jid.DomainBareJid> getXMPPServiceDomains()
                                                                          throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                                                 org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                                                 org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                                 java.lang.InterruptedException
        Deprecated.
        Returns a collection with the XMPP addresses of the Multi-User Chat services.
        Returns:
        a collection with the XMPP addresses of the Multi-User Chat services.
        Throws:
        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.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • providesMucService

        public boolean providesMucService​(org.jxmpp.jid.DomainBareJid domainBareJid)
                                   throws org.jivesoftware.smack.SmackException.NoResponseException,
                                          org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                          org.jivesoftware.smack.SmackException.NotConnectedException,
                                          java.lang.InterruptedException
        Check if the provided domain bare JID provides a MUC service.
        Parameters:
        domainBareJid - the domain bare JID to check.
        Returns:
        true if the provided JID provides a MUC service, false otherwise.
        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 ยง 6.2 Discovering the Features Supported by a MUC Service
      • getRoomsHostedBy

        public java.util.Map<org.jxmpp.jid.EntityBareJid,​HostedRoom> getRoomsHostedBy​(org.jxmpp.jid.DomainBareJid serviceName)
                                                                                     throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                                                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                                                            org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                                            java.lang.InterruptedException,
                                                                                            MultiUserChatException.NotAMucServiceException
        Returns a Map of HostedRooms where each HostedRoom has the XMPP address of the room and the room's name. Once discovered the rooms hosted by a chat service it is possible to discover more detailed room information or join the room.
        Parameters:
        serviceName - the service that is hosting the rooms to discover.
        Returns:
        a map from the room's address to its HostedRoom information.
        Throws:
        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.
        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.
        Since:
        4.3.1
      • decline

        public void decline​(org.jxmpp.jid.EntityBareJid room,
                            org.jxmpp.jid.EntityBareJid inviter,
                            java.lang.String reason)
                     throws org.jivesoftware.smack.SmackException.NotConnectedException,
                            java.lang.InterruptedException
        Informs the sender of an invitation that the invitee declines the invitation. The rejection will be sent to the room which in turn will forward the rejection to the inviter.
        Parameters:
        room - the room that sent the original invitation.
        inviter - the inviter of the declined invitation.
        reason - the reason why the invitee is declining the invitation.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • addInvitationListener

        public void addInvitationListener​(InvitationListener listener)
        Adds a listener to invitation notifications. The listener will be fired anytime an invitation is received.
        Parameters:
        listener - an invitation listener.
      • removeInvitationListener

        public void removeInvitationListener​(InvitationListener listener)
        Removes a listener to invitation notifications. The listener will be fired anytime an invitation is received.
        Parameters:
        listener - an invitation listener.
      • setAutoJoinOnReconnect

        public void setAutoJoinOnReconnect​(boolean autoJoin)
        If automatic join on reconnect is enabled, then the manager will try to auto join MUC rooms after the connection got re-established.
        Parameters:
        autoJoin - true to enable, false to disable.
      • setAutoJoinFailedCallback

        public void setAutoJoinFailedCallback​(AutoJoinFailedCallback failedCallback)
        Set a callback invoked by this manager when automatic join on reconnect failed. If failedCallback is not null, then automatic rejoin get also enabled.
        Parameters:
        failedCallback - the callback.
      • setAutoJoinSuccessCallback

        public void setAutoJoinSuccessCallback​(AutoJoinSuccessCallback successCallback)
        Set a callback invoked by this manager when automatic join on reconnect success. If successCallback is not null, automatic rejoin will also be enabled.
        Parameters:
        successCallback - the callback