Skip to content

Commit

Permalink
Support MSC4140: Delayed events
Browse files Browse the repository at this point in the history
Also implement "parent" delayed events, which were in a previous version
of the MSC and may be reintroduced or be part of a new MSC later.
  • Loading branch information
AndrewFerr committed Aug 1, 2024
1 parent 2b620e0 commit 6466bd1
Show file tree
Hide file tree
Showing 13 changed files with 1,225 additions and 12 deletions.
2 changes: 2 additions & 0 deletions changelog.d/17326.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add initial implementation of delayed events as proposed by [MSC4140](https://github.com/matrix-org/matrix-spec-proposals/pull/4140).

16 changes: 15 additions & 1 deletion synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
# Copyright 2021 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
# Copyright (C) 2023-2024 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -443,6 +443,20 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
"msc3823_account_suspension", False
)

# MSC4140: Delayed events
# The maximum allowed duration for delayed events.
try:
self.msc4140_max_delay = int(experimental["msc4140_max_delay"])
if self.msc4140_max_delay <= 0:
raise ValueError
except ValueError:
raise ConfigError(
"msc4140_max_delay must be a positive integer",
("experimental", "msc4140_max_delay"),
)
except KeyError:
self.msc4140_max_delay = 10 * 365 * 24 * 60 * 60 * 1000 # 10 years

# MSC4151: Report room API (Client-Server API)
self.msc4151_enabled: bool = experimental.get("msc4151_enabled", False)

Expand Down
Loading

0 comments on commit 6466bd1

Please sign in to comment.