federation-api: Move MSCs to per-msc features

Part of #820
This commit is contained in:
Kévin Commaille 2022-02-10 17:38:07 +01:00
parent 36d181daac
commit 431decd140
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C
6 changed files with 19 additions and 4 deletions

View File

@ -12,6 +12,11 @@ Improvements:
* Move `knock` module out of `unstable-pre-spec`
* `knock:::send_knock::v1::Request` requires a PDU instead of the `knock_event`
* Move cross-signing properties of `keys::get_keys::v1::Response` out of `unstable-pre-spec`
* Move MSC implementations from `unstable-pre-spec` to per-msc features:
```
unstable-msc2448
unstable-msc3618
```
# 0.3.1

View File

@ -21,6 +21,8 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
unstable-exhaustive-types = []
unstable-pre-spec = []
unstable-msc2448 = []
unstable-msc3618 = []
client = []
server = []

View File

@ -34,6 +34,7 @@ impl RoomState {
/// Creates an empty `RoomState` with the given `origin`.
///
/// With the `unstable-pre-spec` feature, this method doesn't take any parameters.
/// See [matrix-doc#1664](https://github.com/matrix-org/matrix-doc/issues/1664).
pub fn new(origin: String) -> Self {
Self { origin, auth_chain: Vec::new(), state: Vec::new() }
}
@ -42,7 +43,7 @@ impl RoomState {
/// Creates an empty `RoomState` with the given `origin`.
///
/// Without the `unstable-pre-spec` feature, this method takes a parameter for the origin
/// server.
/// server. See [matrix-doc#1664](https://github.com/matrix-org/matrix-doc/issues/1664).
pub fn new() -> Self {
Self { auth_chain: Vec::new(), state: Vec::new() }
}

View File

@ -48,7 +48,7 @@ ruma_api! {
///
/// This uses the unstable prefix in
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
#[cfg(feature = "unstable-pre-spec")]
#[cfg(feature = "unstable-msc2448")]
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
pub blurhash: Option<String>,
}

View File

@ -35,6 +35,9 @@ ruma_api! {
/// List of persistent updates to rooms.
///
/// Must not be more than 50 items.
///
/// With the `unstable-pre-spec` feature, sending `pdus` is optional.
/// See [matrix-doc#2824](https://github.com/matrix-org/matrix-doc/issues/2824).
#[cfg_attr(feature = "unstable-pre-spec", serde(default, skip_serializing_if = "<[_]>::is_empty"))]
pub pdus: &'a [Box<RawJsonValue>],
@ -48,8 +51,10 @@ ruma_api! {
#[derive(Default)]
response: {
/// Map of event IDs and response for each PDU given in the request.
// https://github.com/matrix-org/matrix-doc/pull/3618 makes returning `pdus` optional.
#[cfg_attr(feature = "unstable-pre-spec", serde(default))]
///
/// With the `unstable-msc3618` feature, returning `pdus` is optional.
/// See [MSC3618](https://github.com/matrix-org/matrix-doc/pull/3618).
#[cfg_attr(feature = "unstable-msc3618", serde(default))]
#[serde(with = "crate::serde::pdu_process_response")]
pub pdus: BTreeMap<Box<EventId>, Result<(), String>>,
}

View File

@ -116,6 +116,8 @@ unstable-pre-spec = [
"ruma-signatures/unstable-pre-spec",
"ruma-state-res/__unstable-pre-spec", # for tests
]
unstable-msc2448 = ["ruma-federation-api/unstable-msc2448"]
unstable-msc3618 = ["ruma-federation-api/unstable-msc3618"]
[dependencies]
assign = "1.1.1"