Skip to content

Commit 6466bd1

Browse files
committed
Support MSC4140: Delayed events
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.
1 parent 2b620e0 commit 6466bd1

File tree

13 files changed

+1225
-12
lines changed

13 files changed

+1225
-12
lines changed

changelog.d/17326.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add initial implementation of delayed events as proposed by [MSC4140](https://github.com/matrix-org/matrix-spec-proposals/pull/4140).
2+

synapse/config/experimental.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is licensed under the Affero General Public License (AGPL) version 3.
33
#
44
# Copyright 2021 The Matrix.org Foundation C.I.C.
5-
# Copyright (C) 2023 New Vector, Ltd
5+
# Copyright (C) 2023-2024 New Vector, Ltd
66
#
77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU Affero General Public License as
@@ -443,6 +443,20 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
443443
"msc3823_account_suspension", False
444444
)
445445

446+
# MSC4140: Delayed events
447+
# The maximum allowed duration for delayed events.
448+
try:
449+
self.msc4140_max_delay = int(experimental["msc4140_max_delay"])
450+
if self.msc4140_max_delay <= 0:
451+
raise ValueError
452+
except ValueError:
453+
raise ConfigError(
454+
"msc4140_max_delay must be a positive integer",
455+
("experimental", "msc4140_max_delay"),
456+
)
457+
except KeyError:
458+
self.msc4140_max_delay = 10 * 365 * 24 * 60 * 60 * 1000 # 10 years
459+
446460
# MSC4151: Report room API (Client-Server API)
447461
self.msc4151_enabled: bool = experimental.get("msc4151_enabled", False)
448462

0 commit comments

Comments
 (0)