chore(sdk): Move ensure_room_encryption_ready to end of file

This commit is contained in:
Skye Elliot
2025-08-21 15:23:13 +01:00
committed by Andy Balaam
parent 13b86a3f5d
commit 41fcebbcb0

View File

@@ -162,24 +162,6 @@ impl<'a> SendRawMessageLikeEvent<'a> {
}
}
/// Ensures the room is ready for encrypted events to be sent.
#[cfg(feature = "e2e-encryption")]
async fn ensure_room_encryption_ready(room: &Room) -> Result<()> {
if !room.are_members_synced() {
room.sync_members().await?;
}
// Query keys in case we don't have them for newly synced members.
//
// Note we do it all the time, because we might have sync'd members before
// sending a message (so didn't enter the above branch), but
// could have not query their keys ever.
room.query_keys_for_untracked_or_dirty_users().await?;
room.preshare_room_key().await?;
Ok(())
}
impl<'a> IntoFuture for SendRawMessageLikeEvent<'a> {
type Output = Result<send_message_event::v3::Response>;
boxed_into_future!(extra_bounds: 'a);
@@ -520,3 +502,22 @@ impl<'a> IntoFuture for SendStateEvent<'a> {
})
}
}
/// Ensures the room is ready for encrypted events to be sent.
#[cfg(feature = "e2e-encryption")]
async fn ensure_room_encryption_ready(room: &Room) -> Result<()> {
if !room.are_members_synced() {
room.sync_members().await?;
}
// Query keys in case we don't have them for newly synced members.
//
// Note we do it all the time, because we might have sync'd members before
// sending a message (so didn't enter the above branch), but
// could have not query their keys ever.
room.query_keys_for_untracked_or_dirty_users().await?;
room.preshare_room_key().await?;
Ok(())
}