base: Include the to-device events when returning the sync response
parent
43ea9a16a0
commit
508bf3b23d
|
@ -30,8 +30,8 @@ use matrix_sdk_common::{
|
|||
events::{
|
||||
presence::PresenceEvent,
|
||||
room::member::{MemberEventContent, MembershipState},
|
||||
AnyBasicEvent, AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent, EventContent,
|
||||
StateEvent,
|
||||
AnyBasicEvent, AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent,
|
||||
AnyToDeviceEvent, EventContent, StateEvent,
|
||||
},
|
||||
identifiers::{RoomId, UserId},
|
||||
locks::RwLock,
|
||||
|
@ -868,14 +868,19 @@ impl BaseClient {
|
|||
account_data: AccountData {
|
||||
events: changes.account_data.into_iter().map(|(_, e)| e).collect(),
|
||||
},
|
||||
to_device: response
|
||||
.to_device
|
||||
.events
|
||||
.into_iter()
|
||||
.filter_map(|e| e.deserialize().ok())
|
||||
.collect::<Vec<AnyToDeviceEvent>>()
|
||||
.into(),
|
||||
device_lists: response.device_lists,
|
||||
device_one_time_keys_count: response
|
||||
.device_one_time_keys_count
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, v.into()))
|
||||
.collect(),
|
||||
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
if let Some(emitter) = self.event_emitter.read().await.as_ref() {
|
||||
|
|
|
@ -64,6 +64,12 @@ pub struct ToDevice {
|
|||
pub events: Vec<AnyToDeviceEvent>,
|
||||
}
|
||||
|
||||
impl From<Vec<AnyToDeviceEvent>> for ToDevice {
|
||||
fn from(events: Vec<AnyToDeviceEvent>) -> Self {
|
||||
Self { events }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
pub struct Rooms {
|
||||
/// The rooms that the user has left or been banned from.
|
||||
|
|
Loading…
Reference in New Issue