Add default push rules including setting a sound for messages mentioning your username / display name

This commit is contained in:
David Baker 2015-01-29 18:38:22 +00:00
parent 4bdfce30d7
commit 1235f7f383
2 changed files with 74 additions and 8 deletions

35
synapse/push/baserules.py Normal file
View file

@ -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'
}
]
},
]