#[non_exhaustive]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 (Non-exhaustive)§
This struct is marked as non-exhaustive
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§
Source§impl ConditionalPushRule
impl ConditionalPushRule
Default override push rules
Sourcepub fn master() -> ConditionalPushRule
Available on crate feature events
only.
pub fn master() -> ConditionalPushRule
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.
Sourcepub fn suppress_notices() -> ConditionalPushRule
Available on crate feature events
only.
pub fn suppress_notices() -> ConditionalPushRule
events
only.Matches messages with a msgtype
of notice
.
Sourcepub fn invite_for_me(user_id: &UserId) -> ConditionalPushRule
Available on crate feature events
only.
pub fn invite_for_me(user_id: &UserId) -> ConditionalPushRule
events
only.Matches any invites to a new room for this user.
Sourcepub fn member_event() -> ConditionalPushRule
Available on crate feature events
only.
pub fn member_event() -> ConditionalPushRule
events
only.Matches any m.room.member_event
.
Sourcepub fn is_user_mention(user_id: &UserId) -> ConditionalPushRule
Available on crate feature events
only.
pub fn is_user_mention(user_id: &UserId) -> ConditionalPushRule
events
only.Matches any message which contains the user’s Matrix ID in the list of user_ids
under the
m.mentions
property.
Sourcepub 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.
pub fn contains_display_name() -> ConditionalPushRule
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.
Sourcepub fn tombstone() -> ConditionalPushRule
Available on crate feature events
only.
pub fn tombstone() -> ConditionalPushRule
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.
Sourcepub fn is_room_mention() -> ConditionalPushRule
Available on crate feature events
only.
pub fn is_room_mention() -> ConditionalPushRule
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
.
Sourcepub 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.
pub fn roomnotif() -> ConditionalPushRule
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.
Sourcepub fn reaction() -> ConditionalPushRule
Available on crate feature events
only.
pub fn reaction() -> ConditionalPushRule
events
only.Matches reactions to a message.
Sourcepub fn server_acl() -> ConditionalPushRule
Available on crate feature events
only.
pub fn server_acl() -> ConditionalPushRule
events
only.Matches room server ACLs.
Sourcepub fn suppress_edits() -> ConditionalPushRule
Available on crate feature events
only.
pub fn suppress_edits() -> ConditionalPushRule
events
only.Matches event replacements.
Sourcepub fn poll_response() -> ConditionalPushRule
Available on crate features events
and unstable-msc3930
only.
pub fn poll_response() -> ConditionalPushRule
events
and unstable-msc3930
only.Source§impl ConditionalPushRule
impl ConditionalPushRule
Default underrides push rules
Sourcepub fn call() -> ConditionalPushRule
Available on crate feature events
only.
pub fn call() -> ConditionalPushRule
events
only.Matches any incoming VOIP call.
Sourcepub fn encrypted_room_one_to_one() -> ConditionalPushRule
Available on crate feature events
only.
pub fn encrypted_room_one_to_one() -> ConditionalPushRule
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.
Sourcepub fn room_one_to_one() -> ConditionalPushRule
Available on crate feature events
only.
pub fn room_one_to_one() -> ConditionalPushRule
events
only.Matches any message sent in a room with exactly two members.
Sourcepub fn message() -> ConditionalPushRule
Available on crate feature events
only.
pub fn message() -> ConditionalPushRule
events
only.Matches all chat messages.
Sourcepub fn encrypted() -> ConditionalPushRule
Available on crate feature events
only.
pub fn encrypted() -> ConditionalPushRule
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.
Sourcepub fn poll_start_one_to_one() -> ConditionalPushRule
Available on crate features events
and unstable-msc3930
only.
pub fn poll_start_one_to_one() -> ConditionalPushRule
events
and unstable-msc3930
only.Sourcepub fn poll_start() -> ConditionalPushRule
Available on crate features events
and unstable-msc3930
only.
pub fn poll_start() -> ConditionalPushRule
events
and unstable-msc3930
only.Sourcepub fn poll_end_one_to_one() -> ConditionalPushRule
Available on crate features events
and unstable-msc3930
only.
pub fn poll_end_one_to_one() -> ConditionalPushRule
events
and unstable-msc3930
only.Sourcepub fn poll_end() -> ConditionalPushRule
Available on crate features events
and unstable-msc3930
only.
pub fn poll_end() -> ConditionalPushRule
events
and unstable-msc3930
only.Source§impl ConditionalPushRule
impl ConditionalPushRule
Sourcepub fn applies(
&self,
event: &FlattenedJson,
context: &PushConditionRoomCtx,
) -> bool
Available on crate feature events
only.
pub fn applies( &self, event: &FlattenedJson, context: &PushConditionRoomCtx, ) -> bool
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
impl Clone for ConditionalPushRule
Source§fn clone(&self) -> ConditionalPushRule
fn clone(&self) -> ConditionalPushRule
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ConditionalPushRule
impl Debug for ConditionalPushRule
Source§impl<'de> Deserialize<'de> for ConditionalPushRule
impl<'de> Deserialize<'de> for ConditionalPushRule
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConditionalPushRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConditionalPushRule, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Equivalent<ConditionalPushRule> for str
impl Equivalent<ConditionalPushRule> for str
Source§fn equivalent(&self, key: &ConditionalPushRule) -> bool
fn equivalent(&self, key: &ConditionalPushRule) -> bool
key
and return true
if they are equal.Source§impl From<ConditionalPushRule> for PushRule
impl From<ConditionalPushRule> for PushRule
Source§fn from(push_rule: ConditionalPushRule) -> PushRule
fn from(push_rule: ConditionalPushRule) -> PushRule
Source§impl From<ConditionalPushRuleInit> for ConditionalPushRule
impl From<ConditionalPushRuleInit> for ConditionalPushRule
Source§fn from(init: ConditionalPushRuleInit) -> ConditionalPushRule
fn from(init: ConditionalPushRuleInit) -> ConditionalPushRule
Source§impl From<NewConditionalPushRule> for ConditionalPushRule
impl From<NewConditionalPushRule> for ConditionalPushRule
Source§fn from(new_rule: NewConditionalPushRule) -> ConditionalPushRule
fn from(new_rule: NewConditionalPushRule) -> ConditionalPushRule
Source§impl From<PushRule> for ConditionalPushRule
impl From<PushRule> for ConditionalPushRule
Source§fn from(push_rule: PushRule) -> ConditionalPushRule
fn from(push_rule: PushRule) -> ConditionalPushRule
Source§impl Hash for ConditionalPushRule
impl Hash for ConditionalPushRule
Source§impl PartialEq for ConditionalPushRule
impl PartialEq for ConditionalPushRule
Source§impl Serialize for ConditionalPushRule
impl Serialize for ConditionalPushRule
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ConditionalPushRule
Auto Trait Implementations§
impl Freeze for ConditionalPushRule
impl RefUnwindSafe for ConditionalPushRule
impl Send for ConditionalPushRule
impl Sync for ConditionalPushRule
impl Unpin for ConditionalPushRule
impl UnwindSafe for ConditionalPushRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.