Add room version H11

This commit is contained in:
nexy7574 2025-06-13 17:55:56 +01:00
parent d7514178ab
commit bb69ee68d0
No known key found for this signature in database
GPG key ID: 0FA334385D0B689F
3 changed files with 37 additions and 23 deletions

11
Cargo.lock generated
View file

@ -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",

View file

@ -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",

View file

@ -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<Self> {
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}`"))),
})
}