Struct ruma_common::push::ConditionalPushRule[][src]

#[non_exhaustive]
pub struct ConditionalPushRule { pub actions: Vec<Action>, pub default: bool, pub enabled: bool, pub rule_id: String, pub conditions: Vec<PushCondition>, }

Like SimplePushRule, but with an additional conditions field.

Only applicable to underride and override rules.

To create an instance of this type, first create a ConditionalPushRuleInit and convert it via ConditionalPushRule::from / .into().

Fields (Non-exhaustive)

Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct {{ .. }} syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
actions: Vec<Action>

Actions to determine if and how a notification is delivered for events matching this rule.

default: bool

Whether this is a default rule, or has been set explicitly.

enabled: bool

Whether the push rule is enabled or not.

rule_id: String

The ID of this rule.

conditions: Vec<PushCondition>

The conditions that must hold true for an event in order for a rule to be applied to an event.

A rule with no conditions always matches.

Implementations

impl ConditionalPushRule[src]

Default override push rules

pub fn master() -> Self[src]

Matches all events, this can be enabled to turn off all push notifications other than those generated by override rules set by the user.

pub fn suppress_notices() -> Self[src]

Matches messages with a msgtype of notice.

pub fn invite_for_me(user_id: &UserId) -> Self[src]

Matches any invites to a new room for this user.

pub fn member_event() -> Self[src]

Matches any m.room.member_event.

pub fn contains_display_name() -> Self[src]

Matches any message whose content is unencrypted and contains the user’s current display name in the room in which it was sent.

pub fn tombstone() -> Self[src]

Matches any state event whose type is m.room.tombstone. This is intended to notify users of a room when it is upgraded, similar to what an @room notification would accomplish.

pub fn roomnotif() -> Self[src]

Matches any message whose content is unencrypted and contains the text @room, signifying the whole room should be notified of the event.

impl ConditionalPushRule[src]

Default underrides push rules

pub fn call() -> Self[src]

Matches any incoming VOIP call.

pub fn encrypted_room_one_to_one() -> Self[src]

Matches any encrypted event sent in a room with exactly two members. Unlike other push rules, this rule cannot be matched against the content of the event by nature of it being encrypted. This causes the rule to be an “all or nothing” match where it either matches all events that are encrypted (in 1:1 rooms) or none.

pub fn room_one_to_one() -> Self[src]

Matches any message sent in a room with exactly two members.

pub fn message() -> Self[src]

Matches all chat messages.

pub fn encrypted() -> Self[src]

Matches all encrypted events. Unlike other push rules, this rule cannot be matched against the content of the event by nature of it being encrypted. This causes the rule to be an “all or nothing” match where it either matches all events that are encrypted (in group rooms) or none.

impl ConditionalPushRule[src]

pub fn applies(
    &self,
    event: &FlattenedJson,
    context: &PushConditionRoomCtx
) -> bool
[src]

Check if the push rule 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.

Trait Implementations

impl Clone for ConditionalPushRule[src]

impl Debug for ConditionalPushRule[src]

impl<'de> Deserialize<'de> for ConditionalPushRule[src]

impl Eq for ConditionalPushRule[src]

impl From<ConditionalPushRuleInit> for ConditionalPushRule[src]

impl Hash for ConditionalPushRule[src]

impl PartialEq<ConditionalPushRule> for ConditionalPushRule[src]

impl Serialize for ConditionalPushRule[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.