public class ListMessageRestriction extends Object implements MessageRestriction
| Modifier and Type | Field and Description |
|---|---|
static MessageRestriction |
ALLOW_ALL
MessageRestriction that permits all MTypes, except as overridden
by
x-samp.mostly-harmless annotations. |
static MessageRestriction |
DEFAULT
Default MessageRestriction implementation.
|
static String[] |
DEFAULT_SAFE_MTYPES
Default list of MType patterns returned by
getSafeMTypes(). |
static MessageRestriction |
DENY_ALL
MessageRestriction that blocks all MTypes, except as overridden
by
x-samp.mostly-harmless annotations. |
static String |
SAFE_MTYPE_PROP
System property used to specify a default list of known safe MTypes,
which the
DEFAULT policy will permit. |
| Constructor and Description |
|---|
ListMessageRestriction(boolean allow,
String[] mtypes,
boolean useSubsInfo)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static String[] |
getSafeMTypes()
Returns a list of MType patterns which are permitted by the DEFAULT
policy.
|
boolean |
permitSend(String mtype,
Map subsInfo)
Indicates whether a message covered by a given MType subscription
may be sent.
|
String |
toString() |
public static String[] DEFAULT_SAFE_MTYPES
getSafeMTypes().public static final String SAFE_MTYPE_PROP
DEFAULT policy will permit.
The value is a comma-separated list of MType patterns.public static final MessageRestriction DEFAULT
getSafeMTypes(), and blocks all others.
However, client subscriptions may override this by annotating their
subscriptions with an entry having the key
"x-samp.mostly-harmless".
If this has the value "1" the MType thus annotated is allowed,
and if it has the value "0" it is blocked, regardless of the safe list.public static final MessageRestriction ALLOW_ALL
x-samp.mostly-harmless annotations.public static final MessageRestriction DENY_ALL
x-samp.mostly-harmless annotations.public ListMessageRestriction(boolean allow,
String[] mtypes,
boolean useSubsInfo)
allow - whether the sense of the mtypes list is those
that should be allowed (true) or blocked (false)mtypes - mtype patterns to be allowed or blockeduseSubsInfo - if true, honour x-samp.mostly-harmless
subscription annotationspublic boolean permitSend(String mtype, Map subsInfo)
MessageRestrictionpermitSend in interface MessageRestrictionmtype - the MType string to be sentsubsInfo - the annotation map corresponding to the MType
subscription (the value from the Subscriptions map
corresponding to the mtype key)public static String[] getSafeMTypes()
DEFAULT_SAFE_MTYPES array is returned.Copyright © 2008–2024. All rights reserved.