Hierarchy

  • PushProcessor

Constructors

Properties

client: MatrixClient

The Matrix client object to use

parsedKeys: Map<string, string[]> = ...

Maps the original key from the push rules to a list of property names after unescaping.

cachedGlobToRegex: Record<string, RegExp> = {}

Methods

  • Parameters

    • prefix: string
    • glob: string
    • suffix: string

    Returns RegExp

  • Check whether the given event matches the push rule condition by fetching the property from the event and comparing against the condition's glob-based pattern.

    Parameters

    Returns boolean

  • Get one of the users push rules by its ID

    Returns

    rule The push rule, or null if no such rule was found

    Returns

    kind - The PushRuleKind of the rule to search for

    Parameters

    • ruleId: string

      The ID of the rule to search for

    Returns null | {
        kind: PushRuleKind;
        rule: IPushRule;
    }

  • Get one of the users push rules by its ID

    Returns

    The push rule, or null if no such rule was found

    Parameters

    • ruleId: string

      The ID of the rule to search for

    Returns null | IPushRule

  • Pre-caches the parsed keys for push rules and cleans out any obsolete cache entries. Should be called after push rules are updated.

    Parameters

    Returns void

  • For a dotted field and event, fetch the value at that position, if one exists.

    Returns

    The value at the dotted path given by key.

    Parameters

    • key: string

      The key of the push rule condition: a dotted field to fetch.

    • ev: MatrixEvent

      The matrix event to fetch the field from.

    Returns any

  • Convert a list of actions into a object with the actions as keys and their values

    Example

    eg. [ 'notify', { set_tweak: 'sound', value: 'default' } ] becomes { notify: true, tweaks: { sound: 'default' } }

    Returns

    A object with key 'notify' (true or false) and an object of actions

    Parameters

    Returns IActionsObject

  • Internal

    Parse the key into the separate fields to search by splitting on unescaped ".", and then removing any escape characters.

    Returns

    The unescaped parts to fetch.

    Parameters

    • str: string

      The key of the push rule condition: a dotted field.

    Returns string[]

  • Rewrites conditions on a client's push rules to match the defaults where applicable. Useful for upgrading push rules to more strict conditions when the server is falling behind on defaults.

    Returns

    The rewritten rules

    Parameters

    • incomingRules: IPushRules

      The client's existing push rules

    • userId: undefined | string = undefined

      The Matrix ID of the client.

    Returns IPushRules

Generated using TypeDoc