1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-10-03 18:50:45 +00:00

Toward abstracting Pdu into trait Event.

Co-authored-by: Jade Ellis <jade@ellis.link>
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-04-26 08:24:47 +00:00 committed by Jade Ellis
parent 3d0360bcd6
commit 116f85360f
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
41 changed files with 842 additions and 886 deletions

View file

@ -473,9 +473,7 @@ async fn handle_left_room(
prev_batch: Some(next_batch.to_string()),
events: Vec::new(),
},
state: RoomState {
events: vec![event.into_sync_state_event()],
},
state: RoomState { events: vec![event.into_format()] },
}));
}
@ -559,7 +557,7 @@ async fn handle_left_room(
continue;
}
left_state_events.push(pdu.into_sync_state_event());
left_state_events.push(pdu.into_format());
}
}
@ -755,7 +753,7 @@ async fn load_joined_room(
.wide_filter_map(|item| ignored_filter(services, item, sender_user))
.map(at!(1))
.chain(joined_sender_member.into_iter().stream())
.map(|pdu| pdu.to_sync_room_event())
.map(Event::into_format)
.collect::<Vec<_>>();
let account_data_events = services
@ -877,10 +875,7 @@ async fn load_joined_room(
events: room_events,
},
state: RoomState {
events: state_events
.into_iter()
.map(PduEvent::into_sync_state_event)
.collect(),
events: state_events.into_iter().map(Event::into_format).collect(),
},
ephemeral: Ephemeral { events: edus },
unread_thread_notifications: BTreeMap::new(),

View file

@ -6,7 +6,7 @@ use std::{
use axum::extract::State;
use conduwuit::{
Err, Error, PduCount, PduEvent, Result, debug, error, extract_variant,
Err, Error, Event, PduCount, PduEvent, Result, at, debug, error, extract_variant,
matrix::TypeStateKey,
utils::{
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
@ -604,7 +604,8 @@ pub(crate) async fn sync_events_v4_route(
.iter()
.stream()
.filter_map(|item| ignored_filter(&services, item.clone(), sender_user))
.map(|(_, pdu)| pdu.to_sync_room_event())
.map(at!(1))
.map(Event::into_format)
.collect()
.await;
@ -626,7 +627,7 @@ pub(crate) async fn sync_events_v4_route(
.state_accessor
.room_state_get(room_id, &state.0, &state.1)
.await
.map(PduEvent::into_sync_state_event)
.map(PduEvent::into_format)
.ok()
})
.collect()

View file

@ -7,11 +7,8 @@ use std::{
use axum::extract::State;
use conduwuit::{
Err, Error, Result, error, extract_variant, is_equal_to,
matrix::{
TypeStateKey,
pdu::{PduCount, PduEvent},
},
Err, Error, Result, at, error, extract_variant, is_equal_to,
matrix::{Event, TypeStateKey, pdu::PduCount},
trace,
utils::{
BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt,
@ -515,7 +512,8 @@ where
.iter()
.stream()
.filter_map(|item| ignored_filter(services, item.clone(), sender_user))
.map(|(_, pdu)| pdu.to_sync_room_event())
.map(at!(1))
.map(Event::into_format)
.collect()
.await;
@ -537,7 +535,7 @@ where
.state_accessor
.room_state_get(room_id, &state.0, &state.1)
.await
.map(PduEvent::into_sync_state_event)
.map(Event::into_format)
.ok()
})
.collect()