mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-16 05:36:50 +00:00
Abstract Pdu filter matching into trait Event.
Abstract Pdu unsigned accessors into trait Event. Abstract Pdu relation related into trait Event. Abstract PDU content into trait Event. Move event_id utils from pdu to event. Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
222e89f6fe
commit
af7dfb31bc
56 files changed
+666
-492
No files matched your search
@@ -22,7 +22,11 @@ use ruma::{
|
||||
OwnedEventId, OwnedRoomId, RoomId, RoomVersionId,
|
||||
events::room::create::RoomCreateEventContent,
|
||||
};
|
||||
use tuwunel_core::{Err, PduEvent, Result, RoomVersion, Server, utils::MutexMap};
|
||||
use tuwunel_core::{
|
||||
Err, Result, RoomVersion, Server,
|
||||
matrix::{Event, PduEvent},
|
||||
utils::MutexMap,
|
||||
};
|
||||
|
||||
use crate::{Dep, globals, rooms, sending, server_keys};
|
||||
|
||||
@@ -108,11 +112,11 @@ impl Service {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_room_id(room_id: &RoomId, pdu: &PduEvent) -> Result {
|
||||
if pdu.room_id != room_id {
|
||||
fn check_room_id<Pdu: Event>(room_id: &RoomId, pdu: &Pdu) -> Result {
|
||||
if pdu.room_id() != room_id {
|
||||
return Err!(Request(InvalidParam(error!(
|
||||
pdu_event_id = ?pdu.event_id,
|
||||
pdu_room_id = ?pdu.room_id,
|
||||
pdu_event_id = ?pdu.event_id(),
|
||||
pdu_room_id = ?pdu.room_id(),
|
||||
?room_id,
|
||||
"Found event from room in room",
|
||||
))));
|
||||
@@ -121,7 +125,7 @@ fn check_room_id(room_id: &RoomId, pdu: &PduEvent) -> Result {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_room_version_id(create_event: &PduEvent) -> Result<RoomVersionId> {
|
||||
fn get_room_version_id<Pdu: Event>(create_event: &Pdu) -> Result<RoomVersionId> {
|
||||
let content: RoomCreateEventContent = create_event.get_content()?;
|
||||
let room_version = content.room_version;
|
||||
|
||||
|
||||
Reference in new issue
Block a user