From 98ecd3c97dbc3e6b48626c022719c696a68da586 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 26 Feb 2015 18:49:34 +0000 Subject: [PATCH] SYN-267 Specify a set of standard server default rules and specify no notifications if no rules match. --- drafts/push_csapi.rst | 82 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/drafts/push_csapi.rst b/drafts/push_csapi.rst index 67ddfb8b..2c61ffc5 100644 --- a/drafts/push_csapi.rst +++ b/drafts/push_csapi.rst @@ -105,6 +105,88 @@ character. In addition, all rules may be enabled or disabled. Disabled rules never match. +If no rules match an event, the Home Server should not notify for the message +(that is to say, the default action is "dont-notify"). + +Predefined Rules +---------------- +Matrix specifies the following rule IDs for server default rules. Home Servers +may define rules as follows with the given IDs. If Home Servers provide rules +with these IDs, their semantics should match those given below: + +.m.rule.contains_user_name + Matches any message whose content is unencrypted and contains the local part + of the user's Matrix ID, separated by word boundaries. + + Definition (as a content rule):: + { + "rule_id": ".m.rule.contains_user_name" + "pattern": "[the lcoal part of the user's Matrix ID]", + "actions": [ + "notify", + { + "set_tweak": "sound", + "value": "default" + } + ], + } + +.m.rule.contains_display_name + Matches any message whose content is unencrypted and contains the user's + current display name in the room in which it was sent. + + Definition (this rule can only be an override or underride rule):: + { + "rule_id": ".m.rule.contains_display_name" + "conditions": [ + { + "kind": "contains_display_name" + } + ], + "actions": [ + "notify", + { + "set_tweak": "sound", + "value": "default" + } + ], + } + +.m.rule.room_two_members + Matches any message sent in a room with exactly two members. + + Definition (this rule can only be an override or underride rule):: + { + "rule_id": ".m.rule.room_two_members" + "conditions": [ + { + "is": "2", + "kind": "room_member_count" + } + ], + "actions": [ + "notify", + { + "set_tweak": "sound", + "value": "default" + } + ], + } + +.m.rule.fallback + Matches any message. Used to define the behaviour of messages that match no + other rules. Therefore, if Home Servers define this, it should be the lowest + priority underride rule. + + Definition:: + { + "rule_id": ".m.rule.fallback" + "conditions": [], + "actions": [ + "notify" + ], + } + Push Rules: Actions: -------------------- All rules have an associated list of 'actions'. An action affects if and how a