SSS: implement typing indications

This commit is contained in:
Lambda 2025-05-31 22:03:23 +00:00
parent 3f315ee683
commit f903421c3f

View file

@ -573,6 +573,28 @@ pub(crate) async fn sync_events_v5_route(
None
};
let typing = if body.extensions.typing.enabled == Some(true) {
let mut typing = BTreeMap::new();
for room_id in todo_rooms.keys() {
if services().rooms.edus.typing.last_typing_update(room_id).await?
> globalsince
{
let event =
services().rooms.edus.typing.typings_all(room_id).await?;
let Ok(event) = Raw::new(&event) else {
continue;
};
typing.insert(room_id.clone(), event);
}
}
Some(sync_events::v5::response::Typing {
rooms: typing,
})
} else {
None
};
let mut rooms = BTreeMap::new();
for (room_id, todo_room) in todo_rooms {
if let Some(room) =
@ -587,9 +609,7 @@ pub(crate) async fn sync_events_v5_route(
e2ee: e2ee.unwrap_or_default(),
account_data: account_data.unwrap_or_default(),
receipts: receipts.unwrap_or_default(),
typing: sync_events::v5::response::Typing {
rooms: BTreeMap::new(),
},
typing: typing.unwrap_or_default(),
};
let extensions_empty = extensions