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

  • 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

  • Check whether the given event matches the push rule condition by fetching the property from the event and comparing exactly against the condition's value.

    Parameters

    Returns boolean

  • Check whether the given event matches the push rule condition by fetching the property from the event and comparing exactly against the condition's value.

    Parameters

    Returns boolean

  • Get one of the users push rules by its ID

    Parameters

    • ruleId: string

      The ID of the rule to search for

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

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

  • Get one of the users push rules by its ID

    Parameters

    • ruleId: string

      The ID of the rule to search for

    Returns null | IPushRule

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

  • 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.

    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

    The value at the dotted path given by key.

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

    Parameters

    Returns IActionsObject

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

    Example

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

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

    Parameters

    • str: string

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

    Returns string[]

    The unescaped parts to fetch.

  • 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.

    Parameters

    • incomingRules: IPushRules

      The client's existing push rules

    • userId: undefined | string = undefined

      The Matrix ID of the client.

    Returns IPushRules

    The rewritten rules

Generated using TypeDoc