From ef2afd9f6e6c2a4033e92f8496be7f289b75b79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 30 Sep 2022 16:51:47 +0200 Subject: [PATCH] api: Add support for Matrix v1.4 --- crates/ruma-common/CHANGELOG.md | 4 ++++ crates/ruma-common/src/api/metadata.rs | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/ruma-common/CHANGELOG.md b/crates/ruma-common/CHANGELOG.md index d33d3c9a..1a8cca2a 100644 --- a/crates/ruma-common/CHANGELOG.md +++ b/crates/ruma-common/CHANGELOG.md @@ -6,6 +6,10 @@ Breaking changes: * Remove deprecated constructors for `RoomMessageEventContent` * Remove `serde::vec_as_map_of_empty` from the public API +Improvements: + +* Add `MatrixVersion::V1_4` + # 0.10.3 Bug fixes: diff --git a/crates/ruma-common/src/api/metadata.rs b/crates/ruma-common/src/api/metadata.rs index 082c824d..c74c018f 100644 --- a/crates/ruma-common/src/api/metadata.rs +++ b/crates/ruma-common/src/api/metadata.rs @@ -252,6 +252,11 @@ pub enum MatrixVersion { /// /// See . V1_3, + + /// Version 1.4 of the Matrix specification, released in Q3 2022. + /// + /// See . + V1_4, } impl TryFrom<&str> for MatrixVersion { @@ -268,6 +273,7 @@ impl TryFrom<&str> for MatrixVersion { "v1.1" => V1_1, "v1.2" => V1_2, "v1.3" => V1_3, + "v1.4" => V1_4, _ => return Err(UnknownVersionError), }) } @@ -310,6 +316,7 @@ impl MatrixVersion { MatrixVersion::V1_1 => (1, 1), MatrixVersion::V1_2 => (1, 2), MatrixVersion::V1_3 => (1, 3), + MatrixVersion::V1_4 => (1, 4), } } @@ -320,6 +327,7 @@ impl MatrixVersion { (1, 1) => Ok(MatrixVersion::V1_1), (1, 2) => Ok(MatrixVersion::V1_2), (1, 3) => Ok(MatrixVersion::V1_3), + (1, 4) => Ok(MatrixVersion::V1_4), _ => Err(UnknownVersionError), } } @@ -334,7 +342,9 @@ impl MatrixVersion { // | MatrixVersion::V1_2 => RoomVersionId::V6, // - MatrixVersion::V1_3 => RoomVersionId::V9, + MatrixVersion::V1_3 + // + | MatrixVersion::V1_4 => RoomVersionId::V9, } } }