#[non_exhaustive]pub enum PushCondition {
EventMatch {
key: String,
pattern: String,
},
ContainsDisplayName,
RoomMemberCount {
is: RoomMemberCountIs,
},
SenderNotificationPermission {
key: NotificationPowerLevelsKey,
},
RoomVersionSupports {
feature: RoomVersionFeature,
},
EventPropertyIs {
key: String,
value: ScalarJsonValue,
},
EventPropertyContains {
key: String,
value: ScalarJsonValue,
},
ThreadSubscription {
subscribed: bool,
},
}
Expand description
A condition that must apply for an associated push rule’s action to be taken.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EventMatch
A glob pattern match on a field of the event.
Fields
key: String
The dot-separated path of the property of the event to match.
ContainsDisplayName
Matches unencrypted messages where content.body
contains the owner’s display name in that
room.
RoomMemberCount
Matches the current number of members in the room.
Fields
is: RoomMemberCountIs
The condition on the current number of members in the room.
SenderNotificationPermission
Takes into account the current power levels in the room, ensuring the sender of the event has high enough power to trigger the notification.
Fields
key: NotificationPowerLevelsKey
The field in the power level event the user needs a minimum power level for.
Fields must be specified under the notifications
property in the power level event’s
content
.
RoomVersionSupports
Apply the rule only to rooms that support a given feature.
Fields
feature: RoomVersionFeature
The feature the room must support for the push rule to apply.
EventPropertyIs
Exact value match on a property of the event.
Fields
key: String
The dot-separated path of the property of the event to match.
value: ScalarJsonValue
The value to match against.
EventPropertyContains
Exact value match on a value in an array property of the event.
Fields
key: String
The dot-separated path of the property of the event to match.
value: ScalarJsonValue
The value to match against.
ThreadSubscription
Matches a thread event based on the user’s thread subscription status, as defined by MSC4306.
Implementations§
Source§impl PushCondition
impl PushCondition
Sourcepub async fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx,
) -> bool
Available on crate feature events
only.
pub async fn applies( &self, event: &FlattenedJson, context: &PushConditionRoomCtx, ) -> bool
events
only.Check if this condition applies to the event.
§Arguments
event
- The flattened JSON representation of a room message event.context
- The context of the room at the time of the event. If the power levels context is missing from it, conditions that depend on it will never apply.
Trait Implementations§
Source§impl Clone for PushCondition
impl Clone for PushCondition
Source§fn clone(&self) -> PushCondition
fn clone(&self) -> PushCondition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more