Add PduId wrapper struct

Death to Vec<u8>
This commit is contained in:
Lambda 2024-08-26 16:47:50 +00:00
parent 341f4213d0
commit 26322d5a95
15 changed files with 110 additions and 71 deletions

View file

@ -1372,7 +1372,7 @@ pub(crate) async fn invite_helper(
)
})?;
let pdu_id: Vec<u8> = services()
let pdu_id = services()
.rooms
.event_handler
.handle_incoming_pdu(

View file

@ -84,7 +84,9 @@ pub(crate) async fn search_events_route(
if let Some(s) = searches
.iter_mut()
.map(|s| (s.peek().cloned(), s))
.max_by_key(|(peek, _)| peek.clone())
.max_by_key(|(peek, _)| {
peek.as_ref().map(|id| id.as_bytes().to_vec())
})
.and_then(|(_, i)| i.next())
{
results.push(s);

View file

@ -1622,7 +1622,7 @@ async fn create_join_event(
.roomid_mutex_federation
.lock_key(room_id.to_owned())
.await;
let pdu_id: Vec<u8> = services()
let pdu_id = services()
.rooms
.event_handler
.handle_incoming_pdu(