diff options
author | Erik Johnston <erik@matrix.org> | 2019-01-23 17:27:43 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-01-23 17:27:43 +0000 |
commit | fd654a4d54e812857fff273609ac6d14ae5d28aa (patch) | |
tree | 62b3d8217b482f0b62daee407ebc649b494b340d /synapse/events/__init__.py | |
parent | Update newsfile (diff) | |
parent | Newsfile (diff) | |
download | synapse-fd654a4d54e812857fff273609ac6d14ae5d28aa.tar.xz |
Merge branch 'erikj/msc_1813' into erikj/require_format_version
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r-- | synapse/events/__init__.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 9dd6940385..e6f94e68af 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -18,7 +18,7 @@ from distutils.util import strtobool import six -from synapse.api.constants import EventFormatVersions +from synapse.api.constants import KNOWN_ROOM_VERSIONS, EventFormatVersions from synapse.util.caches import intern_dict from synapse.util.frozenutils import freeze @@ -235,3 +235,18 @@ class FrozenEvent(EventBase): self.get("type", None), self.get("state_key", None), ) + + +def room_version_to_event_format(room_version): + """Converts a room version string to the event format + + Args: + room_version (str) + + Returns: + int + """ + if room_version not in KNOWN_ROOM_VERSIONS: + raise + + return EventFormatVersions.V1 |