pub struct ConditionalPushRule {
    pub actions: Vec<Action>,
    pub default: bool,
    pub enabled: bool,
    pub rule_id: String,
    pub conditions: Vec<PushCondition>,
}
Expand description

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§

§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§

source§

impl ConditionalPushRule

Default override push rules

source

pub fn master() -> ConditionalPushRule

Available on crate feature events only.

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

source

pub fn suppress_notices() -> ConditionalPushRule

Available on crate feature events only.

Matches messages with a msgtype of notice.

source

pub fn invite_for_me(user_id: &UserId) -> ConditionalPushRule

Available on crate feature events only.

Matches any invites to a new room for this user.

source

pub fn member_event() -> ConditionalPushRule

Available on crate feature events only.

Matches any m.room.member_event.

source

pub fn is_user_mention(user_id: &UserId) -> ConditionalPushRule

Available on crate feature events only.

Matches any message which contains the user’s Matrix ID in the list of user_ids under the m.mentions property.

source

pub fn contains_display_name() -> ConditionalPushRule

👎Deprecated: Since Matrix 1.7. Use the m.mentions property with ConditionalPushRule::is_user_mention() instead.
Available on crate feature events only.

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

Since Matrix 1.7, this rule only matches if the event’s content does not contain an m.mentions property.

source

pub fn tombstone() -> ConditionalPushRule

Available on crate feature events only.

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.

source

pub fn is_room_mention() -> ConditionalPushRule

Available on crate feature events only.

Matches any message from a sender with the proper power level with the room property of the m.mentions property set to true.

source

pub fn roomnotif() -> ConditionalPushRule

👎Deprecated: Since Matrix 1.7. Use the m.mentions property with ConditionalPushRule::is_room_mention() instead.
Available on crate feature events only.

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

Since Matrix 1.7, this rule only matches if the event’s content does not contain an m.mentions property.

source

pub fn reaction() -> ConditionalPushRule

Available on crate feature events only.

Matches reactions to a message.

source

pub fn server_acl() -> ConditionalPushRule

Available on crate feature events only.
source

pub fn suppress_edits() -> ConditionalPushRule

Available on crate feature events only.
source

pub fn poll_response() -> ConditionalPushRule

Available on crate features events and unstable-msc3930 only.

Matches a poll response event sent in any room.

This rule uses the unstable prefixes defined in MSC3381 and MSC3930.

source§

impl ConditionalPushRule

Default underrides push rules

source

pub fn call() -> ConditionalPushRule

Available on crate feature events only.

Matches any incoming VOIP call.

source

pub fn encrypted_room_one_to_one() -> ConditionalPushRule

Available on crate feature events only.

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.

source

pub fn room_one_to_one() -> ConditionalPushRule

Available on crate feature events only.

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

source

pub fn message() -> ConditionalPushRule

Available on crate feature events only.

Matches all chat messages.

source

pub fn encrypted() -> ConditionalPushRule

Available on crate feature events only.

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.

source

pub fn poll_start_one_to_one() -> ConditionalPushRule

Available on crate features events and unstable-msc3930 only.

Matches a poll start event sent in a room with exactly two members.

This rule uses the unstable prefixes defined in MSC3381 and MSC3930.

source

pub fn poll_start() -> ConditionalPushRule

Available on crate features events and unstable-msc3930 only.

Matches a poll start event sent in any room.

This rule uses the unstable prefixes defined in MSC3381 and MSC3930.

source

pub fn poll_end_one_to_one() -> ConditionalPushRule

Available on crate features events and unstable-msc3930 only.

Matches a poll end event sent in a room with exactly two members.

This rule uses the unstable prefixes defined in MSC3381 and MSC3930.

source

pub fn poll_end() -> ConditionalPushRule

Available on crate features events and unstable-msc3930 only.

Matches a poll end event sent in any room.

This rule uses the unstable prefixes defined in MSC3381 and MSC3930.

source§

impl ConditionalPushRule

source

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

Available on crate feature events only.

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§

source§

impl Clone for ConditionalPushRule

source§

fn clone(&self) -> ConditionalPushRule

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ConditionalPushRule

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for ConditionalPushRule

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<ConditionalPushRule, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Equivalent<ConditionalPushRule> for str

source§

fn equivalent(&self, key: &ConditionalPushRule) -> bool

Compare self to key and return true if they are equal.
source§

impl From<ConditionalPushRule> for PushRule

source§

fn from(push_rule: ConditionalPushRule) -> PushRule

Converts to this type from the input type.
source§

impl From<ConditionalPushRuleInit> for ConditionalPushRule

source§

fn from(init: ConditionalPushRuleInit) -> ConditionalPushRule

Converts to this type from the input type.
source§

impl From<NewConditionalPushRule> for ConditionalPushRule

source§

fn from(new_rule: NewConditionalPushRule) -> ConditionalPushRule

Converts to this type from the input type.
source§

impl From<PushRule> for ConditionalPushRule

source§

fn from(push_rule: PushRule) -> ConditionalPushRule

Converts to this type from the input type.
source§

impl Hash for ConditionalPushRule

source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for ConditionalPushRule

source§

fn eq(&self, other: &ConditionalPushRule) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ConditionalPushRule

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for ConditionalPushRule

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

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

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

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

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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