#[non_exhaustive]pub enum PushCondition {
EventMatch(EventMatchConditionData),
ContainsDisplayName,
RoomMemberCount(RoomMemberCountConditionData),
SenderNotificationPermission(SenderNotificationPermissionConditionData),
RoomVersionSupports(RoomVersionSupportsConditionData),
EventPropertyIs(EventPropertyIsConditionData),
EventPropertyContains(EventPropertyContainsConditionData),
ThreadSubscription(ThreadSubscriptionConditionData),
}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(EventMatchConditionData)
A glob pattern match on a field of the event.
ContainsDisplayName
Matches unencrypted messages where content.body contains the owner’s display name in that
room.
RoomMemberCount(RoomMemberCountConditionData)
Matches the current number of members in the room.
SenderNotificationPermission(SenderNotificationPermissionConditionData)
Takes into account the current power levels in the room, ensuring the sender of the event has high enough power to trigger the notification.
RoomVersionSupports(RoomVersionSupportsConditionData)
unstable-msc3931 only.Apply the rule only to rooms that support a given feature.
EventPropertyIs(EventPropertyIsConditionData)
Exact value match on a property of the event.
EventPropertyContains(EventPropertyContainsConditionData)
Exact value match on a value in an array property of the event.
ThreadSubscription(ThreadSubscriptionConditionData)
unstable-msc4306 only.Matches a thread event based on the user’s thread subscription status, as defined by MSC4306.
Implementations§
Source§impl PushCondition
impl PushCondition
Sourcepub fn custom_data(&self) -> Option<&JsonObject>
pub fn custom_data(&self) -> Option<&JsonObject>
The data, if this is a custom condition.
Sourcepub async fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx,
) -> bool
pub async fn applies( &self, event: &FlattenedJson, context: &PushConditionRoomCtx, ) -> bool
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.
Returns false if this condition is unsupported.
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 moreSource§impl Debug for PushCondition
impl Debug for PushCondition
Source§impl<'de> Deserialize<'de> for PushCondition
impl<'de> Deserialize<'de> for PushCondition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<EventMatchConditionData> for PushCondition
impl From<EventMatchConditionData> for PushCondition
Source§fn from(value: EventMatchConditionData) -> Self
fn from(value: EventMatchConditionData) -> Self
Source§impl From<EventPropertyContainsConditionData> for PushCondition
impl From<EventPropertyContainsConditionData> for PushCondition
Source§fn from(value: EventPropertyContainsConditionData) -> Self
fn from(value: EventPropertyContainsConditionData) -> Self
Source§impl From<EventPropertyIsConditionData> for PushCondition
impl From<EventPropertyIsConditionData> for PushCondition
Source§fn from(value: EventPropertyIsConditionData) -> Self
fn from(value: EventPropertyIsConditionData) -> Self
Source§impl From<RoomMemberCountConditionData> for PushCondition
impl From<RoomMemberCountConditionData> for PushCondition
Source§fn from(value: RoomMemberCountConditionData) -> Self
fn from(value: RoomMemberCountConditionData) -> Self
Source§impl From<RoomVersionSupportsConditionData> for PushCondition
Available on crate feature unstable-msc3931 only.
impl From<RoomVersionSupportsConditionData> for PushCondition
unstable-msc3931 only.Source§fn from(value: RoomVersionSupportsConditionData) -> Self
fn from(value: RoomVersionSupportsConditionData) -> Self
Source§impl From<SenderNotificationPermissionConditionData> for PushCondition
impl From<SenderNotificationPermissionConditionData> for PushCondition
Source§fn from(value: SenderNotificationPermissionConditionData) -> Self
fn from(value: SenderNotificationPermissionConditionData) -> Self
Source§impl From<ThreadSubscriptionConditionData> for PushCondition
Available on crate feature unstable-msc4306 only.
impl From<ThreadSubscriptionConditionData> for PushCondition
unstable-msc4306 only.