Class PrivacyItem
java.lang.Object
org.jivesoftware.smackx.privacy.packet.PrivacyItem
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
Modifier and TypeClassDescriptionstatic enum
Type defines if the rule is based on JIDs, roster groups or presence subscription types. -
Field Summary
-
Constructor Summary
ConstructorDescriptionPrivacyItem
(boolean allow, long order) PrivacyItem
(boolean allow, UInt32 order) Creates a new fall-through privacy item.PrivacyItem
(PrivacyItem.Type type, CharSequence value, boolean allow, long order) Creates a new privacy item.PrivacyItem
(PrivacyItem.Type type, String value, boolean allow, long order) PrivacyItem
(PrivacyItem.Type type, String value, boolean allow, UInt32 order) Creates a new privacy item. -
Method Summary
Modifier and TypeMethodDescriptiongetOrder()
Returns the order where the receiver is processed.getType()
Returns the type hold the kind of communication it will allow or block.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
Returns whether the receiver allows or denies every kind of communication.boolean
Returns whether the receiver allow or deny incoming IQ stanzas or not.boolean
Returns whether the receiver allows or denies incoming messages or not.boolean
Returns whether the receiver allows or denies incoming presence or not.boolean
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 whether 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.toXML()
Answer an xml representation of the receiver according to the RFC 3921.
-
Field Details
-
SUBSCRIPTION_BOTH
Value for subscription type rules.- See Also:
-
SUBSCRIPTION_TO
- See Also:
-
SUBSCRIPTION_FROM
- See Also:
-
SUBSCRIPTION_NONE
- See Also:
-
-
Constructor Details
-
PrivacyItem
-
PrivacyItem
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 itemorder
- the order of this privacy item
-
PrivacyItem
-
PrivacyItem
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 itemallow
- true if this is an allow itemorder
- the order of this privacy item
-
PrivacyItem
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 itemallow
- true if this is an allow itemorder
- the order of this privacy item
-
-
Method Details
-
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
Returns whether the receiver allow or deny incoming IQ stanzas or not.- Returns:
- the iq filtering status.
-
setFilterIQ
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
Returns whether the receiver allows or denies incoming messages or not.- Returns:
- the message filtering status.
-
setFilterMessage
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
Returns whether the receiver allows or denies incoming presence or not.- Returns:
- the iq filtering incoming presence status.
-
setFilterPresenceIn
Sets whether the receiver allows or denies incoming presence or not.- Parameters:
filterPresenceIn
- indicates if the receiver allows or denies filtering incoming presence.
-
isFilterPresenceOut
Returns whether the receiver allows or denies incoming presence or not.- Returns:
- the iq filtering incoming presence status.
-
setFilterPresenceOut
Sets whether the receiver allows or denies outgoing presence or not.- Parameters:
filterPresenceOut
- indicates if the receiver allows or denies filtering outgoing presence
-
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
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
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
Answer an xml representation of the receiver according to the RFC 3921.- Returns:
- the text xml representation.
-