Interface MUCRole

  • All Known Implementing Classes:
    LocalMUCRole, RemoteMUCRole

    public interface MUCRole
    Defines the permissions and actions that a MUCUser may use in a particular room. Each MUCRole defines the relationship between a MUCRoom and a MUCUser.

    MUCUsers can play different roles in different chatrooms.

    Author:
    Gaston Dombiak
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void changeNickname​(String nickname)
      Changes the nickname of the occupant within the room to the new nickname.
      void destroy()
      Destroys this role after the occupant left the room.
      MUCRole.Affiliation getAffiliation()
      Obtain the affiliation state of the user.
      MUCRoom getChatRoom()
      Obtain the chat room that hosts this user's role.
      String getNickname()
      Obtain the nickname for the user in the chatroom.
      NodeID getNodeID()
      Returns the id of the node that is hosting the room occupant.
      org.xmpp.packet.Presence getPresence()
      Obtain the current presence status of a user in a chatroom.
      MUCRole.Role getRole()
      Obtain the role state of the user.
      org.xmpp.packet.JID getRoleAddress()
      Obtain the XMPPAddress representing this role in a room: room@server/nickname
      org.xmpp.packet.JID getUserAddress()
      Obtain the XMPPAddress of the user that joined the room.
      boolean isLocal()
      Returns true if this room occupant is hosted by this JVM.
      boolean isVoiceOnly()
      Returns true if the room occupant does not want to get messages broadcasted to all room occupants.
      void send​(org.xmpp.packet.Packet packet)
      Sends a packet to the user.
      void setAffiliation​(MUCRole.Affiliation newAffiliation)
      Call this method to promote or demote a user's affiliation in a chatroom.
      void setPresence​(org.xmpp.packet.Presence presence)
      Set the current presence status of a user in a chatroom.
      void setRole​(MUCRole.Role newRole)
      Call this method to promote or demote a user's role in a chatroom.
    • Method Detail

      • getPresence

        org.xmpp.packet.Presence getPresence()
        Obtain the current presence status of a user in a chatroom.
        Returns:
        The presence of the user in the room.
      • setPresence

        void setPresence​(org.xmpp.packet.Presence presence)
        Set the current presence status of a user in a chatroom.
        Parameters:
        presence - The presence of the user in the room.
      • setRole

        void setRole​(MUCRole.Role newRole)
              throws NotAllowedException
        Call this method to promote or demote a user's role in a chatroom. It is common for the chatroom or other chat room members to change the role of users (a moderator promoting another user to moderator status for example).

        Owning ChatUsers should have their membership roles updated.

        Parameters:
        newRole - The new role that the user will play.
        Throws:
        NotAllowedException - Thrown if trying to change the moderator role to an owner or administrator.
      • getRole

        MUCRole.Role getRole()
        Obtain the role state of the user.
        Returns:
        The role status of this user.
      • setAffiliation

        void setAffiliation​(MUCRole.Affiliation newAffiliation)
                     throws NotAllowedException
        Call this method to promote or demote a user's affiliation in a chatroom.
        Parameters:
        newAffiliation - the new affiliation that the user will play.
        Throws:
        NotAllowedException - thrown if trying to ban an owner or an administrator.
      • getAffiliation

        MUCRole.Affiliation getAffiliation()
        Obtain the affiliation state of the user.
        Returns:
        The affiliation status of this user.
      • changeNickname

        void changeNickname​(String nickname)
        Changes the nickname of the occupant within the room to the new nickname.
        Parameters:
        nickname - the new nickname of the occupant in the room.
      • getNickname

        String getNickname()
        Obtain the nickname for the user in the chatroom.
        Returns:
        The user's nickname in the room or null if invisible.
      • destroy

        void destroy()
        Destroys this role after the occupant left the room. This role will be removed from MUCUser.
      • isVoiceOnly

        boolean isVoiceOnly()
        Returns true if the room occupant does not want to get messages broadcasted to all room occupants. This type of users are called "deaf" occupants. Deaf occupants will still be able to get private messages, presences, IQ packets or room history.

        To be a deaf occupant the initial presence sent to the room while joining the room has to include the following child element:

         <x xmlns='http://jivesoftware.org/protocol/muc'>
             <deaf-occupant/>
         </x>
         
        Note that this is a custom extension to the MUC specification.
        Returns:
        true if the room occupant does not want to get messages broadcasted to all room occupants.
      • getChatRoom

        MUCRoom getChatRoom()
        Obtain the chat room that hosts this user's role.
        Returns:
        The chatroom hosting this role.
      • getRoleAddress

        org.xmpp.packet.JID getRoleAddress()
        Obtain the XMPPAddress representing this role in a room: room@server/nickname
        Returns:
        The Jabber ID that represents this role in the room.
      • getUserAddress

        org.xmpp.packet.JID getUserAddress()
        Obtain the XMPPAddress of the user that joined the room. A null null value represents the room's role.
        Returns:
        The address of the user that joined the room or null if this role belongs to the room itself.
      • isLocal

        boolean isLocal()
        Returns true if this room occupant is hosted by this JVM.
        Returns:
        true if this room occupant is hosted by this JVM
      • getNodeID

        NodeID getNodeID()
        Returns the id of the node that is hosting the room occupant.
        Returns:
        the id of the node that is hosting the room occupant.
      • send

        void send​(org.xmpp.packet.Packet packet)
        Sends a packet to the user.
        Parameters:
        packet - The packet to send