ruwuma/src/event_kinds.rs
Jonas Platte 1f2c186ce1
Remove ToDeviceEventContent
… since any event can be sent using to-device messaging
2020-06-09 01:22:50 +02:00

89 lines
2.6 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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<C: BasicEventContent> {
/// Data specific to the event type.
pub content: C,
}
/// Ephemeral room event.
#[derive(Clone, Debug, Event)]
pub struct EphemeralRoomEvent<C: EphemeralRoomEventContent> {
/// 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<C: MessageEventContent> {
/// 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<C: StateEventContent> {
/// 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<C>,
/// Additional key-value pairs not signed by the homeserver.
pub unsigned: UnsignedData,
}
#[derive(Clone, Debug, Event)]
pub struct ToDeviceEvent<C: EventContent> {
/// Data specific to the event type.
pub content: C,
/// The fully-qualified ID of the user who sent this event.
pub sender: UserId,
}