api: Add support for Matrix v1.5

This commit is contained in:
Kévin Commaille 2022-11-25 13:43:26 +01:00 committed by Kévin Commaille
parent 5f8e72feac
commit 0feb39298a
2 changed files with 12 additions and 2 deletions

View File

@ -32,7 +32,7 @@ Breaking changes:
Improvements:
* Add `MatrixVersion::V1_4`
* Add `MatrixVersion::V1_4` and `MatrixVersion::V1_5`
* Stabilize default room server ACL push rule
* Stabilize `room_types` in `directory::Filter` and `room_type` in `directory::PublicRoomsChunk`
* Stabilize support for private read receipts

View File

@ -500,6 +500,11 @@ pub enum MatrixVersion {
///
/// See <https://spec.matrix.org/v1.4/>.
V1_4,
/// Version 1.5 of the Matrix specification, released in Q4 2022.
///
/// See <https://spec.matrix.org/v1.5/>.
V1_5,
}
impl TryFrom<&str> for MatrixVersion {
@ -517,6 +522,7 @@ impl TryFrom<&str> for MatrixVersion {
"v1.2" => V1_2,
"v1.3" => V1_3,
"v1.4" => V1_4,
"v1.5" => V1_5,
_ => return Err(UnknownVersionError),
})
}
@ -560,6 +566,7 @@ impl MatrixVersion {
MatrixVersion::V1_2 => (1, 2),
MatrixVersion::V1_3 => (1, 3),
MatrixVersion::V1_4 => (1, 4),
MatrixVersion::V1_5 => (1, 5),
}
}
@ -571,6 +578,7 @@ impl MatrixVersion {
(1, 2) => Ok(MatrixVersion::V1_2),
(1, 3) => Ok(MatrixVersion::V1_3),
(1, 4) => Ok(MatrixVersion::V1_4),
(1, 5) => Ok(MatrixVersion::V1_5),
_ => Err(UnknownVersionError),
}
}
@ -644,7 +652,9 @@ impl MatrixVersion {
// <https://spec.matrix.org/v1.3/rooms/#complete-list-of-room-versions>
MatrixVersion::V1_3
// <https://spec.matrix.org/v1.4/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_4 => RoomVersionId::V9,
| MatrixVersion::V1_4
// <https://spec.matrix.org/v1.5/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_5 => RoomVersionId::V9,
}
}
}