update our MSC3266 implementation

Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
June Clementine Strawberry 2025-04-02 19:37:07 -04:00
parent 8c74682395
commit 7c97c2b1a2
No known key found for this signature in database
3 changed files with 78 additions and 4 deletions

View file

@ -26,6 +26,7 @@ pub mod msc3266 {
authentication: AccessTokenOptional,
history: {
unstable => "/_matrix/client/unstable/im.nheko.summary/summary/:room_id_or_alias",
//1.15 => "/_matrix/client/v1/summary/:room_id_or_alias",
}
};
@ -106,6 +107,11 @@ pub mod msc3266 {
alias = "encryption"
)]
pub encryption: Option<EventEncryptionAlgorithm>,
/// If the room is a restricted room, these are the room IDs which are specified by the
/// join rules.
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub allowed_room_ids: Vec<OwnedRoomId>,
}
impl Request {
@ -138,6 +144,7 @@ pub mod msc3266 {
room_version: None,
membership: None,
encryption: None,
allowed_room_ids: Vec::new(),
}
}
}

View file

@ -6,8 +6,8 @@
use js_int::UInt;
use ruma_common::{
room::RoomType, serde::Raw, space::SpaceRoomJoinRule, OwnedMxcUri, OwnedRoomAliasId,
OwnedRoomId,
room::RoomType, serde::Raw, space::SpaceRoomJoinRule, EventEncryptionAlgorithm, OwnedMxcUri,
OwnedRoomAliasId, OwnedRoomId, RoomVersionId,
};
use ruma_events::space::child::HierarchySpaceChildEvent;
use serde::{Deserialize, Serialize};
@ -74,6 +74,28 @@ pub struct SpaceHierarchyRoomsChunk {
///
/// If the room is not a space-room, this should be empty.
pub children_state: Vec<Raw<HierarchySpaceChildEvent>>,
/// If the room is encrypted, the algorithm used for this room.
#[serde(
skip_serializing_if = "Option::is_none",
rename = "im.nheko.summary.encryption",
alias = "encryption"
)]
pub encryption: Option<EventEncryptionAlgorithm>,
/// Version of the room.
#[serde(
skip_serializing_if = "Option::is_none",
rename = "im.nheko.summary.room_version",
alias = "im.nheko.summary.version",
alias = "room_version"
)]
pub room_version: Option<RoomVersionId>,
/// If the room is a restricted room, these are the room IDs which are specified by the
/// join rules.
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub allowed_room_ids: Vec<OwnedRoomId>,
}
/// Initial set of mandatory fields of `SpaceHierarchyRoomsChunk`.
@ -129,6 +151,9 @@ impl From<SpaceHierarchyRoomsChunkInit> for SpaceHierarchyRoomsChunk {
join_rule,
room_type: None,
children_state,
encryption: None,
room_version: None,
allowed_room_ids: Vec::new(),
}
}
}

View file

@ -2,8 +2,8 @@
use js_int::UInt;
use ruma_common::{
room::RoomType, serde::Raw, space::SpaceRoomJoinRule, OwnedMxcUri, OwnedRoomAliasId,
OwnedRoomId,
room::RoomType, serde::Raw, space::SpaceRoomJoinRule, EventEncryptionAlgorithm, OwnedMxcUri,
OwnedRoomAliasId, OwnedRoomId, RoomVersionId,
};
use ruma_events::space::child::HierarchySpaceChildEvent;
use serde::{Deserialize, Serialize};
@ -78,6 +78,23 @@ pub struct SpaceHierarchyParentSummary {
/// rules.
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub allowed_room_ids: Vec<OwnedRoomId>,
/// If the room is encrypted, the algorithm used for this room.
#[serde(
skip_serializing_if = "Option::is_none",
rename = "im.nheko.summary.encryption",
alias = "encryption"
)]
pub encryption: Option<EventEncryptionAlgorithm>,
/// Version of the room.
#[serde(
skip_serializing_if = "Option::is_none",
rename = "im.nheko.summary.room_version",
alias = "im.nheko.summary.version",
alias = "room_version"
)]
pub room_version: Option<RoomVersionId>,
}
/// Initial set of mandatory fields of `SpaceHierarchyParentSummary`.
@ -139,6 +156,8 @@ impl From<SpaceHierarchyParentSummaryInit> for SpaceHierarchyParentSummary {
room_type: None,
children_state,
allowed_room_ids,
encryption: None,
room_version: None,
}
}
}
@ -206,6 +225,23 @@ pub struct SpaceHierarchyChildSummary {
/// rules.
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub allowed_room_ids: Vec<OwnedRoomId>,
/// If the room is encrypted, the algorithm used for this room.
#[serde(
skip_serializing_if = "Option::is_none",
rename = "im.nheko.summary.encryption",
alias = "encryption"
)]
pub encryption: Option<EventEncryptionAlgorithm>,
/// Version of the room.
#[serde(
skip_serializing_if = "Option::is_none",
rename = "im.nheko.summary.room_version",
alias = "im.nheko.summary.version",
alias = "room_version"
)]
pub room_version: Option<RoomVersionId>,
}
/// Initial set of mandatory fields of `SpaceHierarchyChildSummary`.
@ -260,6 +296,8 @@ impl From<SpaceHierarchyChildSummaryInit> for SpaceHierarchyChildSummary {
join_rule,
room_type: None,
allowed_room_ids,
encryption: None,
room_version: None,
}
}
}
@ -279,6 +317,8 @@ impl From<SpaceHierarchyParentSummary> for SpaceHierarchyChildSummary {
room_type,
children_state: _,
allowed_room_ids,
encryption,
room_version,
} = parent;
Self {
@ -293,6 +333,8 @@ impl From<SpaceHierarchyParentSummary> for SpaceHierarchyChildSummary {
join_rule,
room_type,
allowed_room_ids,
encryption,
room_version,
}
}
}