mtx::pushrules::PushRuleEvaluator class

An optimized structure to calculate notifications for events.

You will want to cache this for as long as possible (until the pushrules change), since constructing this is somewhat expensive.

Public types

struct RoomContext
Additional room information needed to evaluate push rules.

Constructors, destructors, conversion operators

PushRuleEvaluator(const Ruleset& rules)
Construct a new push evaluator. Pass the current set of pushrules to evaluate.

Public functions

auto evaluate(const mtx::events::collections::TimelineEvents& event, const RoomContext& ctx, const std::vector<std::pair<mtx::common::Relation, mtx::events::collections::TimelineEvents>>& relatedEvents) const -> std::vector<actions::Action>
Evaluate the pushrules for @event .

Function documentation

std::vector<actions::Action> mtx::pushrules::PushRuleEvaluator::evaluate(const mtx::events::collections::TimelineEvents& event, const RoomContext& ctx, const std::vector<std::pair<mtx::common::Relation, mtx::events::collections::TimelineEvents>>& relatedEvents) const

Evaluate the pushrules for @event .

Returns the actions to apply.

You need to have the room_id set for the event. relatedEvents is a mapping of rel_type to event. Pass all the events that are related to by this event here.