public final class PrivacyRule extends java.lang.Object implements java.lang.Comparable<PrivacyRule>
A privacy rule for privacy lists, which is applied by the server.
- The order in which privacy list items are processed by the server is important. List items MUST be processed in ascending order determined by the integer values of the ‘order’ attribute for each
<item/>
.- As soon as a stanza is matched against a privacy list rule, the server MUST appropriately handle the stanza in accordance with the rule and cease processing.
- If no fall-through item is provided in a list, the fall-through action is assumed to be “allow”.
// Blocks all messages from juliet@example.net
PrivacyRule rule1 = PrivacyRule.blockMessagesFrom(Jid.of("juliet@example.net"), 1);
// Blocks outbound presence notifications to the roster group "Bad Friends".
PrivacyRule rule2 = PrivacyRule.blockPresenceToRosterGroup("Bad Friends", 2);
This class is immutable.
Modifier and Type | Class and Description |
---|---|
static class |
PrivacyRule.Action
Defines the action to perform with the privacy item: either allow or deny communication.
|
static class |
PrivacyRule.Type
Defines the type of communication which should be allowed of denied.
|
Modifier and Type | Method and Description |
---|---|
PrivacyRule |
appliedToInboundPresence()
Creates a new privacy rule, which is applied to inbound presence notifications.
|
PrivacyRule |
appliedToIQs()
Creates a new privacy rule, which is applied to IQ stanzas.
|
PrivacyRule |
appliedToMessages()
Creates a new privacy rule, which is applied to inbound messages.
|
PrivacyRule |
appliedToOutboundPresence()
Creates a new privacy rule, which is applied to outbound presence notifications.
|
static PrivacyRule |
blockAllCommunicationWith(Jid entity,
long order)
Creates a rule, which blocks all communication from and to another entity.
|
static PrivacyRule |
blockAllCommunicationWithEntitiesWithSubscription(SubscriptionState.Subscription subscription,
long order)
Creates a rule, which blocks all communication from and to any entities in the specified roster group.
|
static PrivacyRule |
blockAllCommunicationWithRosterGroup(java.lang.String rosterGroup,
long order)
Creates a rule, which blocks all communication from and to any entities in the specified roster group.
|
static PrivacyRule |
blockInboundPresence(long order)
Creates a rule, which blocks all inbound presence notifications.
|
static PrivacyRule |
blockIQFrom(Jid entity,
long order)
Creates a rule, which blocks all inbound IQ stanzas from another entity.
|
static PrivacyRule |
blockIQFromEntitiesWithSubscription(SubscriptionState.Subscription subscription,
long order)
Creates a rule, which blocks all inbound IQ stanzas from entities with the given subscription type.
|
static PrivacyRule |
blockIQFromRosterGroup(java.lang.String rosterGroup,
long order)
Creates a rule, which blocks all inbound IQ stanzas from contacts, which are in the specified roster group.
|
static PrivacyRule |
blockMessagesFrom(Jid entity,
long order)
Creates a rule, which blocks all inbound messages from another entity.
|
static PrivacyRule |
blockMessagesFromEntitiesWithSubscription(SubscriptionState.Subscription subscription,
long order)
Creates a rule, which blocks all inbound messages from entities with the given subscription type.
|
static PrivacyRule |
blockMessagesFromRosterGroup(java.lang.String rosterGroup,
long order)
Creates a rule, which blocks all inbound messages from contacts, which are in the specified roster group.
|
static PrivacyRule |
blockOutboundPresence(long order)
Creates a rule, which blocks all outbound presence notifications.
|
static PrivacyRule |
blockPresenceFrom(Jid entity,
long order)
Creates a rule, which blocks all inbound presence notifications from another entity.
|
static PrivacyRule |
blockPresenceFromEntitiesWithSubscription(SubscriptionState.Subscription subscription,
long order)
Creates a rule, which blocks all inbound presence notifications from entities with the given subscription type.
|
static PrivacyRule |
blockPresenceFromRosterGroup(java.lang.String rosterGroup,
long order)
Creates a rule, which blocks all inbound presence notifications from contacts, which are in the specified roster group.
|
static PrivacyRule |
blockPresenceTo(Jid entity,
long order)
Creates a rule, which blocks all outbound presence notifications to another entity.
|
static PrivacyRule |
blockPresenceToEntitiesWithSubscription(SubscriptionState.Subscription subscription,
long order)
Creates a rule, which blocks all outbound presence notifications to entities with the given subscription type.
|
static PrivacyRule |
blockPresenceToRosterGroup(java.lang.String rosterGroup,
long order)
Creates a rule, which blocks all outbound presence notifications to contacts, which are in the specified roster group.
|
int |
compareTo(PrivacyRule o)
Compares this rule with another rule by comparing their order.
|
PrivacyRule.Action |
getAction()
Sets the action to perform (either allow or deny).
|
long |
getOrder()
Gets the order in which privacy items are processed by the server.
|
PrivacyRule.Type |
getType()
Gets the type.
|
java.lang.String |
getValue()
Gets the value.
|
boolean |
isAppliedToInboundPresence()
Indicates, whether this rule is applied to inbound presence notifications.
|
boolean |
isAppliedToIQs()
Indicates, whether this rule is applied to inbound IQ stanzas.
|
boolean |
isAppliedToMessages()
Indicates, whether this rule is applied to inbound messages.
|
boolean |
isAppliedToOutboundPresence()
Indicates, whether this rule is applied to outbound presence notifications.
|
static PrivacyRule |
of(Jid jid,
PrivacyRule.Action action,
long order)
Creates a privacy rule of type ‘jid’.
|
static PrivacyRule |
of(PrivacyRule.Action action,
long order)
Creates a privacy list item, which allows or blocks everything.
|
static PrivacyRule |
of(java.lang.String group,
PrivacyRule.Action action,
long order)
Creates a privacy rule of type ‘group’.
|
static PrivacyRule |
of(SubscriptionState.Subscription subscription,
PrivacyRule.Action action,
long order)
Creates a privacy rule of type ‘subscription’.
|
java.lang.String |
toString() |
public static PrivacyRule of(PrivacyRule.Action action, long order)
Creates a privacy list item, which allows or blocks everything.
action
- The action to perform, i.e. either allow or deny.order
- The order in which the privacy item is processed by the server. A non-negative integer that is unique among all items in the list.public static PrivacyRule of(Jid jid, PrivacyRule.Action action, long order)
Creates a privacy rule of type ‘jid’.
jid
- The JID.action
- The action to perform, i.e. either allow or deny.order
- The order in which the privacy item is processed by the server. A non-negative integer that is unique among all items in the list.public static PrivacyRule of(java.lang.String group, PrivacyRule.Action action, long order)
Creates a privacy rule of type ‘group’.
group
- The roster group.action
- The action to perform, i.e. either allow or deny.order
- The order in which the privacy item is processed by the server. A non-negative integer that is unique among all items in the list.public static PrivacyRule of(SubscriptionState.Subscription subscription, PrivacyRule.Action action, long order)
Creates a privacy rule of type ‘subscription’.
subscription
- The subscription type.action
- The action to perform, i.e. either allow or deny.order
- The order in which the privacy item is processed by the server. A non-negative integer that is unique among all items in the list.public static PrivacyRule blockMessagesFrom(Jid entity, long order)
Creates a rule, which blocks all inbound messages from another entity.
The user will not receive messages from the entity with the specified JID.
entity
- The entity.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockMessagesFromRosterGroup(java.lang.String rosterGroup, long order)
Creates a rule, which blocks all inbound messages from contacts, which are in the specified roster group.
The user will not receive messages from any entities in the specified roster group.
rosterGroup
- The roster group.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockMessagesFromEntitiesWithSubscription(SubscriptionState.Subscription subscription, long order)
Creates a rule, which blocks all inbound messages from entities with the given subscription type.
The user will not receive messages from any entities with the specified subscription type.
subscription
- The subscription type.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockPresenceFrom(Jid entity, long order)
Creates a rule, which blocks all inbound presence notifications from another entity.
The user will not receive presence notifications from the entity with the specified JID.
entity
- The entity.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockPresenceFromRosterGroup(java.lang.String rosterGroup, long order)
Creates a rule, which blocks all inbound presence notifications from contacts, which are in the specified roster group.
The user will not receive presence notifications from any entities in the specified roster group.
rosterGroup
- The roster group.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockPresenceFromEntitiesWithSubscription(SubscriptionState.Subscription subscription, long order)
Creates a rule, which blocks all inbound presence notifications from entities with the given subscription type.
The user will not receive presence notifications from any entities with the specified subscription type.
subscription
- The subscription type.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockInboundPresence(long order)
Creates a rule, which blocks all inbound presence notifications.
The user will not receive presence notifications from any other users.
order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockPresenceTo(Jid entity, long order)
Creates a rule, which blocks all outbound presence notifications to another entity.
The user will not send presence notifications to the entity with the specified JID.
entity
- The entity.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockPresenceToRosterGroup(java.lang.String rosterGroup, long order)
Creates a rule, which blocks all outbound presence notifications to contacts, which are in the specified roster group.
The user will not send presence notifications to any entities in the specified roster group.
rosterGroup
- The roster group.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockPresenceToEntitiesWithSubscription(SubscriptionState.Subscription subscription, long order)
Creates a rule, which blocks all outbound presence notifications to entities with the given subscription type.
The user will not send presence notifications to any entities with the specified subscription type.
subscription
- The subscription type.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockOutboundPresence(long order)
Creates a rule, which blocks all outbound presence notifications.
The user will not send presence notifications to any other users.
order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockIQFrom(Jid entity, long order)
Creates a rule, which blocks all inbound IQ stanzas from another entity.
The user will not receive IQ stanzas from the entity with the specified JID.
entity
- The entity.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockIQFromRosterGroup(java.lang.String rosterGroup, long order)
Creates a rule, which blocks all inbound IQ stanzas from contacts, which are in the specified roster group.
The user will not receive IQ stanzas from any entities in the specified roster group.
rosterGroup
- The roster group.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockIQFromEntitiesWithSubscription(SubscriptionState.Subscription subscription, long order)
Creates a rule, which blocks all inbound IQ stanzas from entities with the given subscription type.
The user will not receive IQ stanzas from any entities with the specified subscription type.
subscription
- The subscription type.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockAllCommunicationWithRosterGroup(java.lang.String rosterGroup, long order)
Creates a rule, which blocks all communication from and to any entities in the specified roster group.
The user will not receive any communications from, nor send any stanzas to, any entities in the specified roster group.
rosterGroup
- The roster group.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockAllCommunicationWithEntitiesWithSubscription(SubscriptionState.Subscription subscription, long order)
Creates a rule, which blocks all communication from and to any entities in the specified roster group.
The user will not receive any communications from, nor send any stanzas to, any entities in the specified roster group.
subscription
- The subscription type.order
- The order, this rule will be applied within the privacy list.public static PrivacyRule blockAllCommunicationWith(Jid entity, long order)
Creates a rule, which blocks all communication from and to another entity.
The user will not receive any communications from, nor send any stanzas to, the entity with the specified JID.
entity
- The entity.order
- The order, this rule will be applied within the privacy list.public final PrivacyRule.Type getType()
Gets the type.
public final PrivacyRule.Action getAction()
Sets the action to perform (either allow or deny).
public final java.lang.String getValue()
Gets the value.
public final long getOrder()
Gets the order in which privacy items are processed by the server.
public final boolean isAppliedToMessages()
Indicates, whether this rule is applied to inbound messages.
public final PrivacyRule appliedToMessages()
Creates a new privacy rule, which is applied to inbound messages.
isAppliedToMessages()
public final boolean isAppliedToIQs()
Indicates, whether this rule is applied to inbound IQ stanzas.
public final PrivacyRule appliedToIQs()
Creates a new privacy rule, which is applied to IQ stanzas.
isAppliedToIQs()
public final boolean isAppliedToInboundPresence()
Indicates, whether this rule is applied to inbound presence notifications.
public final PrivacyRule appliedToInboundPresence()
Creates a new privacy rule, which is applied to inbound presence notifications.
isAppliedToInboundPresence()
public final boolean isAppliedToOutboundPresence()
Indicates, whether this rule is applied to outbound presence notifications.
public final PrivacyRule appliedToOutboundPresence()
Creates a new privacy rule, which is applied to outbound presence notifications.
isAppliedToOutboundPresence()
public final int compareTo(PrivacyRule o)
Compares this rule with another rule by comparing their order.
compareTo
in interface java.lang.Comparable<PrivacyRule>
o
- The other rule.public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.