2022-03-03 05:40:53 -06:00
|
|
|
package pushrules
|
|
|
|
|
|
|
|
const (
|
|
|
|
MRuleCall = ".m.rule.call"
|
|
|
|
MRuleEncryptedRoomOneToOne = ".m.rule.encrypted_room_one_to_one"
|
|
|
|
MRuleRoomOneToOne = ".m.rule.room_one_to_one"
|
|
|
|
MRuleMessage = ".m.rule.message"
|
|
|
|
MRuleEncrypted = ".m.rule.encrypted"
|
|
|
|
)
|
|
|
|
|
|
|
|
var defaultUnderrideRules = []*Rule{
|
|
|
|
&mRuleCallDefinition,
|
|
|
|
&mRuleRoomOneToOneDefinition,
|
2022-09-09 06:56:33 -05:00
|
|
|
&mRuleEncryptedRoomOneToOneDefinition,
|
2022-03-03 05:40:53 -06:00
|
|
|
&mRuleMessageDefinition,
|
|
|
|
&mRuleEncryptedDefinition,
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
mRuleCallDefinition = Rule{
|
|
|
|
RuleID: MRuleCall,
|
|
|
|
Default: true,
|
|
|
|
Enabled: true,
|
|
|
|
Conditions: []*Condition{
|
|
|
|
{
|
|
|
|
Kind: EventMatchCondition,
|
|
|
|
Key: "type",
|
2022-12-23 05:52:47 -06:00
|
|
|
Pattern: pointer("m.call.invite"),
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Actions: []*Action{
|
|
|
|
{Kind: NotifyAction},
|
|
|
|
{
|
|
|
|
Kind: SetTweakAction,
|
|
|
|
Tweak: SoundTweak,
|
|
|
|
Value: "ring",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
mRuleEncryptedRoomOneToOneDefinition = Rule{
|
|
|
|
RuleID: MRuleEncryptedRoomOneToOne,
|
|
|
|
Default: true,
|
|
|
|
Enabled: true,
|
|
|
|
Conditions: []*Condition{
|
|
|
|
{
|
|
|
|
Kind: RoomMemberCountCondition,
|
|
|
|
Is: "2",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Kind: EventMatchCondition,
|
|
|
|
Key: "type",
|
2022-12-23 05:52:47 -06:00
|
|
|
Pattern: pointer("m.room.encrypted"),
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Actions: []*Action{
|
|
|
|
{Kind: NotifyAction},
|
2022-09-09 06:56:33 -05:00
|
|
|
{
|
|
|
|
Kind: SetTweakAction,
|
|
|
|
Tweak: SoundTweak,
|
|
|
|
Value: "default",
|
|
|
|
},
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
}
|
|
|
|
mRuleRoomOneToOneDefinition = Rule{
|
|
|
|
RuleID: MRuleRoomOneToOne,
|
|
|
|
Default: true,
|
|
|
|
Enabled: true,
|
|
|
|
Conditions: []*Condition{
|
|
|
|
{
|
|
|
|
Kind: RoomMemberCountCondition,
|
|
|
|
Is: "2",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Kind: EventMatchCondition,
|
|
|
|
Key: "type",
|
2022-12-23 05:52:47 -06:00
|
|
|
Pattern: pointer("m.room.message"),
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Actions: []*Action{
|
|
|
|
{Kind: NotifyAction},
|
|
|
|
{
|
|
|
|
Kind: SetTweakAction,
|
2022-12-23 05:52:47 -06:00
|
|
|
Tweak: SoundTweak,
|
|
|
|
Value: "default",
|
2022-09-09 06:56:33 -05:00
|
|
|
},
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
}
|
|
|
|
mRuleMessageDefinition = Rule{
|
|
|
|
RuleID: MRuleMessage,
|
|
|
|
Default: true,
|
|
|
|
Enabled: true,
|
|
|
|
Conditions: []*Condition{
|
|
|
|
{
|
|
|
|
Kind: EventMatchCondition,
|
|
|
|
Key: "type",
|
2022-12-23 05:52:47 -06:00
|
|
|
Pattern: pointer("m.room.message"),
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
},
|
2022-09-09 06:56:33 -05:00
|
|
|
Actions: []*Action{
|
|
|
|
{Kind: NotifyAction},
|
|
|
|
},
|
2022-03-03 05:40:53 -06:00
|
|
|
}
|
|
|
|
mRuleEncryptedDefinition = Rule{
|
|
|
|
RuleID: MRuleEncrypted,
|
|
|
|
Default: true,
|
|
|
|
Enabled: true,
|
|
|
|
Conditions: []*Condition{
|
|
|
|
{
|
|
|
|
Kind: EventMatchCondition,
|
|
|
|
Key: "type",
|
2022-12-23 05:52:47 -06:00
|
|
|
Pattern: pointer("m.room.encrypted"),
|
2022-03-03 05:40:53 -06:00
|
|
|
},
|
|
|
|
},
|
2022-09-09 06:56:33 -05:00
|
|
|
Actions: []*Action{
|
|
|
|
{Kind: NotifyAction},
|
|
|
|
},
|
2022-03-03 05:40:53 -06:00
|
|
|
}
|
|
|
|
)
|