use std::time::SystemTime; use ruma_events_macros::Event; use ruma_identifiers::{EventId, RoomId, UserId}; use crate::{ BasicEventContent, EphemeralRoomEventContent, EventContent, MessageEventContent, StateEventContent, UnsignedData, }; /// A basic event – one that consists only of it's type and the `content` object. #[derive(Clone, Debug, Event)] pub struct BasicEvent { /// Data specific to the event type. pub content: C, } /// Ephemeral room event. #[derive(Clone, Debug, Event)] pub struct EphemeralRoomEvent { /// Data specific to the event type. pub content: C, /// The ID of the room associated with this event. pub room_id: RoomId, } /// Message event. #[derive(Clone, Debug, Event)] pub struct MessageEvent { /// Data specific to the event type. pub content: C, /// The globally unique event identifier for the user who sent the event. pub event_id: EventId, /// The fully-qualified ID of the user who sent this event. pub sender: UserId, /// Timestamp in milliseconds on originating homeserver when this event was sent. pub origin_server_ts: SystemTime, /// The ID of the room associated with this event. pub room_id: RoomId, /// Additional key-value pairs not signed by the homeserver. pub unsigned: UnsignedData, } /// State event. #[derive(Clone, Debug, Event)] pub struct StateEvent { /// Data specific to the event type. pub content: C, /// The globally unique event identifier for the user who sent the event. pub event_id: EventId, /// The fully-qualified ID of the user who sent this event. pub sender: UserId, /// Timestamp in milliseconds on originating homeserver when this event was sent. pub origin_server_ts: SystemTime, /// The ID of the room associated with this event. pub room_id: RoomId, /// A unique key which defines the overwriting semantics for this piece of room state. /// /// This is often an empty string, but some events send a `UserId` to show /// which user the event affects. pub state_key: String, /// Optional previous content for this event. pub prev_content: Option, /// Additional key-value pairs not signed by the homeserver. pub unsigned: UnsignedData, } #[derive(Clone, Debug, Event)] pub struct ToDeviceEvent { /// Data specific to the event type. pub content: C, /// The fully-qualified ID of the user who sent this event. pub sender: UserId, }