Documentation ¶
Index ¶
- Variables
- func AddRules(kind string, rule pushapitypes.PushRule, rules pushapitypes.Rules) pushapitypes.Rules
- func CheckPusherBody(pushers *external.PostSetPushersRequest) string
- func ConvertConditions(userID, kind string, pushRule pushapitypes.PushRule, forRequest bool) pushapitypes.PushRule
- func ConvertPushRule(data pushapitypes.PushRuleCacheData, defaultRule bool) (pushapitypes.PushRule, error)
- func DeletePushRule(ctx context.Context, pushDB model.PushAPIDatabase, device *authtypes.Device, ...) (int, core.Coder)
- func FormatRuleId(kind string, ruleID string) string
- func FormatRuleResponse(rules pushapitypes.Rules) pushapitypes.RuleSet
- func FormatRules(userID string, cache service.Cache, global pushapitypes.Rules, forRequest bool) pushapitypes.Rules
- func GetBasePushRule(ruleID string) pushapitypes.PushRule
- func GetKindFromRuleId(ruleID string) string
- func GetOriginalRuleId(ruleID string) string
- func GetPushRule(ctx context.Context, device *authtypes.Device, scope string, kind string, ...) (int, core.Coder)
- func GetPushRuleActions(ctx context.Context, device *authtypes.Device, scope string, kind string, ...) (int, core.Coder)
- func GetPushRuleEnabled(ctx context.Context, device *authtypes.Device, scope string, kind string, ...) (int, core.Coder)
- func GetPushRules(device *authtypes.Device, cache service.Cache) (int, core.Coder)
- func GetPushRulesGlobal(device *authtypes.Device, cache service.Cache) (int, core.Coder)
- func GetPushers(userID string, cache service.Cache) (int, core.Coder)
- func GetPushersByName(userID string, cache service.Cache, forRequest bool) pushapitypes.Pushers
- func GetRuleEnabled(userName, ruleID string, cache service.Cache) bool
- func GetUserPushRules(userID string, cache service.Cache, forRequest bool) (global pushapitypes.Rules)
- func GetUsersPushers(users *external.PostUsersPushKeyRequest, cache service.Cache) (int, core.Coder)
- func MakeBaseAppendRule(kind string, modified map[string]pushapitypes.PushRuleCacheData) []pushapitypes.PushRule
- func MakeBasePreAppendRule(kind string, modified map[string]pushapitypes.PushRuleCacheData) []pushapitypes.PushRule
- func PutPushRule(ctx context.Context, pushRule *external.PutPushrulesByIDRequest, ...) (int, core.Coder)
- func PutPushRuleActions(ctx context.Context, actions *external.PutPushrulesActionsByIDRequest, ...) (int, core.Coder)
- func PutPushRuleEnabled(ctx context.Context, enabled *external.PutPushrulesEnabledByIDRequest, ...) (int, core.Coder)
- func PutPusher(ctx context.Context, pushers *external.PostSetPushersRequest, ...) (int, core.Coder)
Constants ¶
This section is empty.
Variables ¶
var BaseContentRules = func() []pushapitypes.PushRule { pushRules := []pushapitypes.PushRule{ { RuleId: "global/content/.m.rule.contains_user_name", Default: true, Enabled: false, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "content.body", Pattern: "user_localpart", }, }, Actions: GetAction2(), }, } return pushRules }
var BaseOverrideRules = func() []pushapitypes.PushRule { pushRules := []pushapitypes.PushRule{ { RuleId: "global/override/.m.rule.suppress_notices", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "content.msgtype", Pattern: "m.notice", }, }, Actions: GetAction(), }, { RuleId: "global/override/.m.rule.invite_for_me", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "type", Pattern: "m.room.member", }, { Kind: "event_match", Key: "content.membership", Pattern: "invite", }, { Kind: "event_match", Key: "state_key", Pattern: "user_id", }, }, Actions: GetAction1(), }, { RuleId: "global/override/.m.rule.member_event", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "type", Pattern: "m.room.member", }, }, Actions: GetAction(), }, { RuleId: "global/override/.m.rule.signals", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "content.msgtype", Pattern: "m.alert", }, { Kind: "signal", }, }, Actions: GetAction2(), }, { RuleId: "global/override/.m.rule.contains_display_name", Default: true, Enabled: false, Conditions: []pushapitypes.PushCondition{ { Kind: "contains_display_name", }, }, Actions: GetAction2(), }, } return pushRules }
var BasePreOverrideRules = func() []pushapitypes.PushRule { pushRule := pushapitypes.PushRule{ RuleId: "global/override/.m.rule.master", Default: true, Enabled: false, Actions: GetAction(), } pushRule.Conditions = []pushapitypes.PushCondition{} pushRules := []pushapitypes.PushRule{pushRule} return pushRules }
var BaseRuleIds = func() map[string]string { rules := map[string]string{ "global/override/.m.rule.master": "override", "global/override/.m.rule.suppress_notices": "override", "global/override/.m.rule.invite_for_me": "override", "global/override/.m.rule.member_event": "override", "global/override/.m.rule.signals": "override", "global/override/.m.rule.contains_display_name": "override", "global/content/.m.rule.contains_user_name": "content", "global/underride/.m.rule.call": "underride", "global/underride/.m.rule.room_one_to_one": "underride", "global/underride/.m.rule.message": "underride", "global/underride/.m.rule.video": "underride", "global/underride/.m.rule.encrypted": "underride", } return rules }
var BaseUnderRideRules = func() []pushapitypes.PushRule { pushRules := []pushapitypes.PushRule{ { RuleId: "global/underride/.m.rule.call", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "type", Pattern: "m.call.invite", }, }, Actions: GetAction4(), }, { RuleId: "global/underride/.m.rule.room_one_to_one", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "room_member_count", Is: "2", }, }, Actions: GetAction1(), }, { RuleId: "global/underride/.m.rule.message", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "type", Pattern: "m.room.message", }, }, Actions: GetAction6(), }, { RuleId: "global/underride/.m.rule.encrypted", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "type", Pattern: "m.room.encrypted", }, }, Actions: GetAction5(), }, { RuleId: "global/underride/.m.rule.video", Default: true, Enabled: true, Conditions: []pushapitypes.PushCondition{ { Kind: "event_match", Key: "type", Pattern: "m.modular.video", }, { Kind: "event_match", Key: "content.data.isCreate", Pattern: "true", }, }, Actions: GetAction5(), }, } return pushRules }
var GetAction = func() []interface{} { var actions []interface{} actions = append(actions, "dont_notify") return actions }
var GetAction1 = func() []interface{} { var actions []interface{} actions = append(actions, "notify") tweaks := []pushapitypes.Tweak{ { SetTweak: "sound", Value: "default", }, { SetTweak: "highlight", Value: false, }, } for _, v := range tweaks { actions = append(actions, v) } return actions }
var GetAction2 = func() []interface{} { var actions []interface{} actions = append(actions, "notify") tweaks := []pushapitypes.Tweak{ { SetTweak: "sound", Value: "default", }, { SetTweak: "highlight", }, } for _, v := range tweaks { actions = append(actions, v) } return actions }
var GetAction3 = func() []interface{} { var actions []interface{} actions = append(actions, "notify") tweaks := []pushapitypes.Tweak{ { SetTweak: "sound", Value: "default", }, } for _, v := range tweaks { actions = append(actions, v) } return actions }
var GetAction4 = func() []interface{} { var actions []interface{} actions = append(actions, "notify") tweaks := []pushapitypes.Tweak{ { SetTweak: "sound", Value: "ring", }, { SetTweak: "highlight", Value: false, }, } for _, v := range tweaks { actions = append(actions, v) } return actions }
var GetAction5 = func() []interface{} { var actions []interface{} actions = append(actions, "notify") tweaks := []pushapitypes.Tweak{ { SetTweak: "highlight", Value: false, }, } for _, v := range tweaks { actions = append(actions, v) } return actions }
var GetAction6 = func() []interface{} { var actions []interface{} actions = append(actions, "notify") tweaks := []pushapitypes.Tweak{ { SetTweak: "sound", Value: "default", }, } for _, v := range tweaks { actions = append(actions, v) } return actions }
Functions ¶
func AddRules ¶
func AddRules(kind string, rule pushapitypes.PushRule, rules pushapitypes.Rules) pushapitypes.Rules
func CheckPusherBody ¶
func CheckPusherBody(pushers *external.PostSetPushersRequest) string
func ConvertConditions ¶
func ConvertConditions(userID, kind string, pushRule pushapitypes.PushRule, forRequest bool) pushapitypes.PushRule
func ConvertPushRule ¶
func ConvertPushRule(data pushapitypes.PushRuleCacheData, defaultRule bool) (pushapitypes.PushRule, error)
func DeletePushRule ¶
func DeletePushRule( ctx context.Context, pushDB model.PushAPIDatabase, device *authtypes.Device, cfg config.Dendrite, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
DeletePushrule implements DELETE /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}
func FormatRuleId ¶
func FormatRuleResponse ¶
func FormatRuleResponse(rules pushapitypes.Rules) pushapitypes.RuleSet
func FormatRules ¶
func FormatRules(userID string, cache service.Cache, global pushapitypes.Rules, forRequest bool) pushapitypes.Rules
func GetBasePushRule ¶
func GetBasePushRule(ruleID string) pushapitypes.PushRule
func GetKindFromRuleId ¶
func GetOriginalRuleId ¶
func GetPushRule ¶
func GetPushRule( ctx context.Context, device *authtypes.Device, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
GetPushrule implements GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}
func GetPushRuleActions ¶
func GetPushRuleActions( ctx context.Context, device *authtypes.Device, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
GetPushruleActions implements GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/actions
func GetPushRuleEnabled ¶
func GetPushRuleEnabled( ctx context.Context, device *authtypes.Device, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
GetPushruleEnabled implements GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/enabled
func GetPushRules ¶
GetPushrule implements GET /_matrix/client/r0/pushrules
func GetPushRulesGlobal ¶
GetPushrule implements GET /_matrix/client/r0/pushrules/global/
func GetPushers ¶
GetPushers implements GET /_matrix/client/r0/pushers
func GetPushersByName ¶
func GetUserPushRules ¶
func GetUsersPushers ¶
func GetUsersPushers( users *external.PostUsersPushKeyRequest, cache service.Cache, ) (int, core.Coder)
GetUsersPushers implements POST /_matrix/client/r0/users/pushkey
func MakeBaseAppendRule ¶
func MakeBaseAppendRule(kind string, modified map[string]pushapitypes.PushRuleCacheData) []pushapitypes.PushRule
func MakeBasePreAppendRule ¶
func MakeBasePreAppendRule(kind string, modified map[string]pushapitypes.PushRuleCacheData) []pushapitypes.PushRule
func PutPushRule ¶
func PutPushRule( ctx context.Context, pushRule *external.PutPushrulesByIDRequest, pushDB model.PushAPIDatabase, device *authtypes.Device, cfg config.Dendrite, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
PutPushrule implements PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}
func PutPushRuleActions ¶
func PutPushRuleActions( ctx context.Context, actions *external.PutPushrulesActionsByIDRequest, pushDB model.PushAPIDatabase, device *authtypes.Device, cfg config.Dendrite, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
PutPushruleActions implements PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/actions
func PutPushRuleEnabled ¶
func PutPushRuleEnabled( ctx context.Context, enabled *external.PutPushrulesEnabledByIDRequest, pushDB model.PushAPIDatabase, device *authtypes.Device, cfg config.Dendrite, scope string, kind string, ruleID string, cache service.Cache, ) (int, core.Coder)
PutPushruleEnabled implements PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/enabled
Types ¶
This section is empty.