sync_events: Parse the to-device events.

This commit is contained in:
Damir Jelić 2020-03-12 13:33:38 +01:00
parent e7526b88cb
commit 7307c695e0

View File

@ -11,6 +11,7 @@ use ruma_events::{
}, },
presence::PresenceEvent, presence::PresenceEvent,
stripped::AnyStrippedStateEvent, stripped::AnyStrippedStateEvent,
to_device::AnyToDeviceEvent,
EventResult, EventResult,
}; };
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
@ -60,6 +61,9 @@ ruma_api! {
/// Updates to the presence status of other users. /// Updates to the presence status of other users.
#[wrap_incoming] #[wrap_incoming]
pub presence: Presence, pub presence: Presence,
/// Messages sent dirrectly between devices.
#[wrap_incoming]
pub to_device: ToDevice,
} }
} }
@ -239,3 +243,11 @@ pub struct Presence {
#[wrap_incoming(PresenceEvent with EventResult)] #[wrap_incoming(PresenceEvent with EventResult)]
pub events: Vec<PresenceEvent>, pub events: Vec<PresenceEvent>,
} }
/// Messages sent dirrectly between devices.
#[derive(Clone, Debug, Serialize, Outgoing)]
pub struct ToDevice {
/// A list of to-device events.
#[wrap_incoming(AnyToDeviceEvent with EventResult)]
pub events: Vec<AnyToDeviceEvent>,
}