api: Add support for Matrix v1.4

This commit is contained in:
Kévin Commaille 2022-09-30 16:51:47 +02:00 committed by Kévin Commaille
parent 715c226975
commit ef2afd9f6e
2 changed files with 15 additions and 1 deletions

View File

@ -6,6 +6,10 @@ Breaking changes:
* Remove deprecated constructors for `RoomMessageEventContent` * Remove deprecated constructors for `RoomMessageEventContent`
* Remove `serde::vec_as_map_of_empty` from the public API * Remove `serde::vec_as_map_of_empty` from the public API
Improvements:
* Add `MatrixVersion::V1_4`
# 0.10.3 # 0.10.3
Bug fixes: Bug fixes:

View File

@ -252,6 +252,11 @@ pub enum MatrixVersion {
/// ///
/// See <https://spec.matrix.org/v1.3/>. /// See <https://spec.matrix.org/v1.3/>.
V1_3, V1_3,
/// Version 1.4 of the Matrix specification, released in Q3 2022.
///
/// See <https://spec.matrix.org/v1.4/>.
V1_4,
} }
impl TryFrom<&str> for MatrixVersion { impl TryFrom<&str> for MatrixVersion {
@ -268,6 +273,7 @@ impl TryFrom<&str> for MatrixVersion {
"v1.1" => V1_1, "v1.1" => V1_1,
"v1.2" => V1_2, "v1.2" => V1_2,
"v1.3" => V1_3, "v1.3" => V1_3,
"v1.4" => V1_4,
_ => return Err(UnknownVersionError), _ => return Err(UnknownVersionError),
}) })
} }
@ -310,6 +316,7 @@ impl MatrixVersion {
MatrixVersion::V1_1 => (1, 1), MatrixVersion::V1_1 => (1, 1),
MatrixVersion::V1_2 => (1, 2), MatrixVersion::V1_2 => (1, 2),
MatrixVersion::V1_3 => (1, 3), MatrixVersion::V1_3 => (1, 3),
MatrixVersion::V1_4 => (1, 4),
} }
} }
@ -320,6 +327,7 @@ impl MatrixVersion {
(1, 1) => Ok(MatrixVersion::V1_1), (1, 1) => Ok(MatrixVersion::V1_1),
(1, 2) => Ok(MatrixVersion::V1_2), (1, 2) => Ok(MatrixVersion::V1_2),
(1, 3) => Ok(MatrixVersion::V1_3), (1, 3) => Ok(MatrixVersion::V1_3),
(1, 4) => Ok(MatrixVersion::V1_4),
_ => Err(UnknownVersionError), _ => Err(UnknownVersionError),
} }
} }
@ -334,7 +342,9 @@ impl MatrixVersion {
// <https://spec.matrix.org/v1.2/rooms/#complete-list-of-room-versions> // <https://spec.matrix.org/v1.2/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_2 => RoomVersionId::V6, | MatrixVersion::V1_2 => RoomVersionId::V6,
// <https://spec.matrix.org/v1.3/rooms/#complete-list-of-room-versions> // <https://spec.matrix.org/v1.3/rooms/#complete-list-of-room-versions>
MatrixVersion::V1_3 => RoomVersionId::V9, MatrixVersion::V1_3
// <https://spec.matrix.org/v1.4/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_4 => RoomVersionId::V9,
} }
} }
} }