summary refs log tree commit diff
path: root/synapse/push/baserules.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-01-29 18:38:22 +0000
committerDavid Baker <dave@matrix.org>2015-01-29 18:38:22 +0000
commit1235f7f383617a91b4b96e287cc1ad205b80a5de (patch)
treeca8b52e47e37ed5959e683cc46391c74af1d4ab1 /synapse/push/baserules.py
parentRenumber priority classes so we can use 0 for defaults. (diff)
downloadsynapse-1235f7f383617a91b4b96e287cc1ad205b80a5de.tar.xz
Add default push rules including setting a sound for messages mentioning your username / display name
Diffstat (limited to 'synapse/push/baserules.py')
-rw-r--r--synapse/push/baserules.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py
new file mode 100644
index 0000000000..4caf7beed2
--- /dev/null
+++ b/synapse/push/baserules.py
@@ -0,0 +1,35 @@
+def make_base_rules(user_name):
+    """
+    Nominally we reserve priority class 0 for these rules, although
+    in practice we just append them to the end so we don't actually need it.
+    """
+    return [
+        {
+            'conditions': [
+                {
+                    'kind': 'event_match',
+                    'key': 'content.body',
+                    'pattern': '*%s*' % (user_name,), # Matrix ID match
+                }
+            ],
+            'actions': [
+                'notify',
+                {
+                    'set_sound': 'default'
+                }
+            ]
+        },
+        {
+            'conditions': [
+                {
+                    'kind': 'contains_display_name'
+                }
+            ],
+            'actions': [
+                'notify',
+                {
+                    'set_sound': 'default'
+                }
+            ]
+        },
+    ]
\ No newline at end of file