Class PrivacyItem


  • public class PrivacyItem
    extends java.lang.Object
    A privacy item acts a rule that when matched defines if a stanza should be blocked or not. Privacy Items can handle different kind of blocking communications based on JID, group, subscription type or globally by:
    • Allowing or blocking messages.
    • Allowing or blocking inbound presence notifications.
    • Allowing or blocking outbound presence notifications.
    • Allowing or blocking IQ stanzas.
    • Allowing or blocking all communications.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PrivacyItem.Type
      Type defines if the rule is based on JIDs, roster groups or presence subscription types.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UInt32 getOrder()
      Returns the order where the receiver is processed.
      PrivacyItem.Type getType()
      Returns the type hold the kind of communication it will allow or block.
      java.lang.String getValue()
      Returns the element identifier to apply the action.
      boolean isAllow()
      Returns the action associated with the item, it MUST be filled and will allow or deny the communication.
      boolean isFilterEverything()
      Returns whether the receiver allows or denies every kind of communication.
      boolean isFilterIQ()
      Returns whether the receiver allow or deny incoming IQ stanzas or not.
      boolean isFilterMessage()
      Returns whether the receiver allows or denies incoming messages or not.
      boolean isFilterPresenceIn()
      Returns whether the receiver allows or denies incoming presence or not.
      boolean isFilterPresenceOut()
      Returns whether the receiver allows or denies incoming presence or not.
      void setFilterIQ​(boolean filterIQ)
      Sets whether the receiver allows or denies incoming IQ stanzas or not.
      void setFilterMessage​(boolean filterMessage)
      Sets wheather the receiver allows or denies incoming messages or not.
      void setFilterPresenceIn​(boolean filterPresenceIn)
      Sets whether the receiver allows or denies incoming presence or not.
      void setFilterPresenceOut​(boolean filterPresenceOut)
      Sets whether the receiver allows or denies outgoing presence or not.
      java.lang.String toXML()
      Answer an xml representation of the receiver according to the RFC 3921.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrivacyItem

        public PrivacyItem​(boolean allow,
                           long order)
      • PrivacyItem

        public PrivacyItem​(boolean allow,
                           UInt32 order)
        Creates a new fall-through privacy item. This is usually the last item in a privacy list and has no 'type' attribute.
        Parameters:
        allow - true if this is an allow item
        order - the order of this privacy item
      • PrivacyItem

        public PrivacyItem​(PrivacyItem.Type type,
                           java.lang.String value,
                           boolean allow,
                           UInt32 order)
        Creates a new privacy item. If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID. If the type is "group", then the 'value' attribute SHOULD contain the name of a group in the user's roster. If the type is "subscription", then the 'value' attribute MUST be one of "both", "to", "from", or "none".
        Parameters:
        type - the type.
        value - the value of the privacy item
        allow - true if this is an allow item
        order - the order of this privacy item
      • PrivacyItem

        public PrivacyItem​(PrivacyItem.Type type,
                           java.lang.CharSequence value,
                           boolean allow,
                           long order)
        Creates a new privacy item. If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID. If the type is "group", then the 'value' attribute SHOULD contain the name of a group in the user's roster. If the type is "subscription", then the 'value' attribute MUST be one of "both", "to", "from", or "none".
        Parameters:
        type - the type.
        value - the value of the privacy item
        allow - true if this is an allow item
        order - the order of this privacy item
    • Method Detail

      • isAllow

        public boolean isAllow()
        Returns the action associated with the item, it MUST be filled and will allow or deny the communication.
        Returns:
        the allow communication status.
      • isFilterIQ

        public boolean isFilterIQ()
        Returns whether the receiver allow or deny incoming IQ stanzas or not.
        Returns:
        the iq filtering status.
      • setFilterIQ

        public void setFilterIQ​(boolean filterIQ)
        Sets whether the receiver allows or denies incoming IQ stanzas or not.
        Parameters:
        filterIQ - indicates if the receiver allows or denies incoming IQ stanzas.
      • isFilterMessage

        public boolean isFilterMessage()
        Returns whether the receiver allows or denies incoming messages or not.
        Returns:
        the message filtering status.
      • setFilterMessage

        public void setFilterMessage​(boolean filterMessage)
        Sets wheather the receiver allows or denies incoming messages or not.
        Parameters:
        filterMessage - indicates if the receiver allows or denies incoming messages or not.
      • isFilterPresenceIn

        public boolean isFilterPresenceIn()
        Returns whether the receiver allows or denies incoming presence or not.
        Returns:
        the iq filtering incoming presence status.
      • setFilterPresenceIn

        public void setFilterPresenceIn​(boolean filterPresenceIn)
        Sets whether the receiver allows or denies incoming presence or not.
        Parameters:
        filterPresenceIn - indicates if the receiver allows or denies filtering incoming presence.
      • isFilterPresenceOut

        public boolean isFilterPresenceOut()
        Returns whether the receiver allows or denies incoming presence or not.
        Returns:
        the iq filtering incoming presence status.
      • setFilterPresenceOut

        public void setFilterPresenceOut​(boolean filterPresenceOut)
        Sets whether the receiver allows or denies outgoing presence or not.
        Parameters:
        filterPresenceOut - indicates if the receiver allows or denies filtering outgoing presence
      • getOrder

        public UInt32 getOrder()
        Returns the order where the receiver is processed. List items are processed in ascending order. The order MUST be filled and its value MUST be a non-negative integer that is unique among all items in the list.
        Returns:
        the order number.
      • getType

        public PrivacyItem.Type getType()
        Returns the type hold the kind of communication it will allow or block. It MUST be filled with one of these values: jid, group or subscription.
        Returns:
        the type of communication it represent.
      • getValue

        public java.lang.String getValue()
        Returns the element identifier to apply the action. If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID. If the type is "group", then the 'value' attribute SHOULD contain the name of a group in the user's roster. If the type is "subscription", then the 'value' attribute MUST be one of "both", "to", "from", or "none".
        Returns:
        the identifier to apply the action.
      • isFilterEverything

        public boolean isFilterEverything()
        Returns whether the receiver allows or denies every kind of communication. When filterIQ, filterMessage, filterPresenceIn and filterPresenceOut are not set the receiver will block all communications.
        Returns:
        the all communications status.
      • toXML

        public java.lang.String toXML()
        Answer an xml representation of the receiver according to the RFC 3921.
        Returns:
        the text xml representation.