summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2021-02-09 19:07:00 +0000
committerGitHub <noreply@github.com>2021-02-09 19:07:00 +0000
commit6bf58d8194ff7c89a1c8249bade78492bbfa0900 (patch)
treedbaccc690b25f7273562569ba25b09c8a0a90b0b /synapse/api
parentAdd complement running monolith synapse to buildkite pipeline (#80) (diff)
downloadsynapse-6bf58d8194ff7c89a1c8249bade78492bbfa0900.tar.xz
Add knocking support (#81)
Implement knocking as defined by https://github.com/matrix-org/matrix-doc/pull/2403

This is the base knocking stuff, taken from https://github.com/matrix-org/synapse/pull/6739
and does not include any public room directory changes.

While knocking hasn't merged yet on mainline due to waiting on getting Complement
into Synapse's CI, the code has been well-tested.
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/constants.py4
-rw-r--r--synapse/api/room_versions.py43
2 files changed, 44 insertions, 3 deletions
diff --git a/synapse/api/constants.py b/synapse/api/constants.py

index 592abd844b..05fc84f6e1 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py
@@ -34,7 +34,7 @@ class Membership: INVITE = "invite" JOIN = "join" - KNOCK = "knock" + KNOCK = "xyz.amorgan.knock" LEAVE = "leave" BAN = "ban" LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN) @@ -50,7 +50,7 @@ class PresenceState: class JoinRules: PUBLIC = "public" - KNOCK = "knock" + KNOCK = "xyz.amorgan.knock" INVITE = "invite" PRIVATE = "private" diff --git a/synapse/api/room_versions.py b/synapse/api/room_versions.py
index f3ecbf36b6..c4d50d2df8 100644 --- a/synapse/api/room_versions.py +++ b/synapse/api/room_versions.py
@@ -57,7 +57,7 @@ class RoomVersion: state_res = attr.ib() # int; one of the StateResolutionVersions enforce_key_validity = attr.ib() # bool - # bool: before MSC2261/MSC2432, m.room.aliases had special auth rules and redaction rules + # Before MSC2432, m.room.aliases had special auth rules and redaction rules special_case_aliases_auth = attr.ib(type=bool) # Strictly enforce canonicaljson, do not allow: # * Integers outside the range of [-2 ^ 53 + 1, 2 ^ 53 - 1] @@ -67,6 +67,11 @@ class RoomVersion: # bool: MSC2209: Check 'notifications' key while verifying # m.room.power_levels auth rules. limit_notifications_power_levels = attr.ib(type=bool) + # MSC2174/MSC2176: Apply updated redaction rules algorithm. + msc2176_redaction_rules = attr.ib(type=bool) + # MSC2403: Allows join_rules to be set to 'knock', changes auth rules to allow sending + # m.room.membership event with membership 'knock'. + allow_knocking = attr.ib(type=bool) class RoomVersions: @@ -79,6 +84,8 @@ class RoomVersions: special_case_aliases_auth=True, strict_canonicaljson=False, limit_notifications_power_levels=False, + msc2176_redaction_rules=False, + allow_knocking=False, ) V2 = RoomVersion( "2", @@ -89,6 +96,8 @@ class RoomVersions: special_case_aliases_auth=True, strict_canonicaljson=False, limit_notifications_power_levels=False, + msc2176_redaction_rules=False, + allow_knocking=False, ) V3 = RoomVersion( "3", @@ -99,6 +108,8 @@ class RoomVersions: special_case_aliases_auth=True, strict_canonicaljson=False, limit_notifications_power_levels=False, + msc2176_redaction_rules=False, + allow_knocking=False, ) V4 = RoomVersion( "4", @@ -109,6 +120,8 @@ class RoomVersions: special_case_aliases_auth=True, strict_canonicaljson=False, limit_notifications_power_levels=False, + msc2176_redaction_rules=False, + allow_knocking=False, ) V5 = RoomVersion( "5", @@ -119,6 +132,8 @@ class RoomVersions: special_case_aliases_auth=True, strict_canonicaljson=False, limit_notifications_power_levels=False, + msc2176_redaction_rules=False, + allow_knocking=False, ) V6 = RoomVersion( "6", @@ -129,6 +144,32 @@ class RoomVersions: special_case_aliases_auth=False, strict_canonicaljson=True, limit_notifications_power_levels=True, + msc2176_redaction_rules=False, + allow_knocking=False, + ) + MSC2176 = RoomVersion( + "org.matrix.msc2176", + RoomDisposition.UNSTABLE, + EventFormatVersions.V3, + StateResolutionVersions.V2, + enforce_key_validity=True, + special_case_aliases_auth=False, + strict_canonicaljson=True, + limit_notifications_power_levels=True, + msc2176_redaction_rules=True, + allow_knocking=False, + ) + MSC2403_DEV = RoomVersion( + "xyz.amorgan.knock", + RoomDisposition.UNSTABLE, + EventFormatVersions.V3, + StateResolutionVersions.V2, + enforce_key_validity=True, + special_case_aliases_auth=False, + strict_canonicaljson=True, + limit_notifications_power_levels=True, + msc2176_redaction_rules=False, + allow_knocking=True, )