From bb69ee68d0674cb87049489dae8c22665916534f Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Fri, 13 Jun 2025 17:55:56 +0100 Subject: [PATCH] Add room version H11 --- Cargo.lock | 11 ------ Cargo.toml | 6 ++-- src/core/matrix/state_res/room_version.rs | 43 ++++++++++++++++++----- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 160be0c7..e7a61534 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3695,7 +3695,6 @@ dependencies = [ [[package]] name = "ruma" version = "0.10.1" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "assign", "js_int", @@ -3715,7 +3714,6 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.10.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "js_int", "ruma-common", @@ -3727,7 +3725,6 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "as_variant", "assign", @@ -3750,7 +3747,6 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "as_variant", "base64 0.22.1", @@ -3782,7 +3778,6 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "as_variant", "indexmap 2.9.0", @@ -3807,7 +3802,6 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "bytes", "headers", @@ -3829,7 +3823,6 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "js_int", "thiserror 2.0.12", @@ -3838,7 +3831,6 @@ dependencies = [ [[package]] name = "ruma-identity-service-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "js_int", "ruma-common", @@ -3848,7 +3840,6 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "cfg-if", "proc-macro-crate", @@ -3863,7 +3854,6 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "js_int", "ruma-common", @@ -3875,7 +3865,6 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.15.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" dependencies = [ "base64 0.22.1", "ed25519-dalek", diff --git a/Cargo.toml b/Cargo.toml index 1abff107..e4c2f665 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -348,9 +348,9 @@ version = "0.1.2" # Used for matrix spec type definitions and helpers [workspace.dependencies.ruma] -git = "https://forgejo.ellis.link/continuwuation/ruwuma" -#branch = "conduwuit-changes" -rev = "d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +#git = "https://forgejo.ellis.link/continuwuation/ruwuma" +#rev = "b1a55ab8fa3d2e3db3240d04339835f71cfc84d4" +path = "../ruwuma/crates/ruma" # nex: temp features = [ "compat", "rand", diff --git a/src/core/matrix/state_res/room_version.rs b/src/core/matrix/state_res/room_version.rs index 8dfd6cde..fead8576 100644 --- a/src/core/matrix/state_res/room_version.rs +++ b/src/core/matrix/state_res/room_version.rs @@ -29,6 +29,8 @@ pub enum StateResolutionVersion { V1, /// State resolution for room at version 2 or later. V2, + /// State resolution for hydra rooms + V2_1, } #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] @@ -80,6 +82,19 @@ pub struct RoomVersion { /// /// See: [MSC2175](https://github.com/matrix-org/matrix-spec-proposals/pull/2175) for more information. pub use_room_create_sender: bool, + /// Whether the room creator is a superuser. + /// A superuser will always have infinite power level and gains special privileges. + /// + /// See: [MSC4289](https://github.com/matrix-org/matrix-spec-proposals/pull/4289) for more information. + pub room_creator_is_superuser: bool, + /// Whether the room version supports estoppel events. + /// + /// See: [MSC4290](https://github.com/matrix-org/matrix-spec-proposals/pull/4290) + pub estoppel_events: bool, + /// Whether the room's m.room.create event ID is itself the room ID. + /// + /// See: [MSC4291](https://github.com/matrix-org/matrix-spec-proposals/pull/4291) + pub create_id_as_room_id: bool, } impl RoomVersion { @@ -97,15 +112,9 @@ impl RoomVersion { knock_restricted_join_rule: false, integer_power_levels: false, use_room_create_sender: false, - }; - pub const V10: Self = Self { - knock_restricted_join_rule: true, - integer_power_levels: true, - ..Self::V9 - }; - pub const V11: Self = Self { - use_room_create_sender: true, - ..Self::V10 + room_creator_is_superuser: false, + estoppel_events: false, + create_id_as_room_id: false, }; pub const V2: Self = Self { state_res: StateResolutionVersion::V2, @@ -130,6 +139,21 @@ impl RoomVersion { pub const V7: Self = Self { allow_knocking: true, ..Self::V6 }; pub const V8: Self = Self { restricted_join_rules: true, ..Self::V7 }; pub const V9: Self = Self::V8; + pub const V10: Self = Self { + knock_restricted_join_rule: true, + integer_power_levels: true, + ..Self::V9 + }; + pub const V11: Self = Self { + use_room_create_sender: true, + ..Self::V10 + }; + pub const HYDRA_V11: Self = Self{ + room_creator_is_superuser: true, + estoppel_events: true, + create_id_as_room_id: true, + ..Self::V11 + }; pub fn new(version: &RoomVersionId) -> Result { Ok(match version { @@ -144,6 +168,7 @@ impl RoomVersion { | RoomVersionId::V9 => Self::V9, | RoomVersionId::V10 => Self::V10, | RoomVersionId::V11 => Self::V11, + | RoomVersionId::HydraV11 => Self::HYDRA_V11, | ver => return Err(Error::Unsupported(format!("found version `{ver}`"))), }) }