Class PrivacyItem

java.lang.Object
org.jivesoftware.smackx.privacy.packet.PrivacyItem

public class PrivacyItem extends 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.
  • Field Details

  • Constructor Details

    • 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, String value, boolean allow, long order)
    • PrivacyItem

      public PrivacyItem(PrivacyItem.Type type, 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, 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 Details

    • 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 whether 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

      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 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 String toXML()
      Answer an xml representation of the receiver according to the RFC 3921.
      Returns:
      the text xml representation.