From 1e365c6a2d4c0a790062f6b30deee73295b0a714 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 9 Jun 2020 01:40:52 +0200 Subject: [PATCH] Re-introduce dedicated event types as type alises --- src/call/answer.rs | 4 ++++ src/receipt.rs | 5 +++++ src/room_key.rs | 7 ++++++- src/sticker.rs | 5 ++++- src/typing.rs | 5 +++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/call/answer.rs b/src/call/answer.rs index 99439f76..fd5c733c 100644 --- a/src/call/answer.rs +++ b/src/call/answer.rs @@ -5,8 +5,12 @@ use ruma_events_macros::MessageEventContent; use serde::{Deserialize, Serialize}; use super::SessionDescription; +use crate::MessageEvent; /// This event is sent by the callee when they wish to answer the call. +pub type AnswerEvent = MessageEvent; + +/// The payload for `AnswerEvent`. #[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[ruma_event(type = "m.call.answer")] pub struct AnswerEventContent { diff --git a/src/receipt.rs b/src/receipt.rs index 61f580a3..651f1e4a 100644 --- a/src/receipt.rs +++ b/src/receipt.rs @@ -10,6 +10,11 @@ use ruma_events_macros::EphemeralRoomEventContent; use ruma_identifiers::{EventId, UserId}; use serde::{Deserialize, Serialize}; +use crate::EphemeralRoomEvent; + +/// Informs the client who has read a message specified by it's event id. +pub type ReceiptEvent = EphemeralRoomEvent; + /// The payload for `ReceiptEvent`. /// /// A mapping of event ID to a collection of receipts for this event ID. The event ID is the ID of diff --git a/src/room_key.rs b/src/room_key.rs index 01ebdeb4..dc7f7c77 100644 --- a/src/room_key.rs +++ b/src/room_key.rs @@ -1,13 +1,18 @@ //! Types for the *m.room_key* event. -use super::Algorithm; use ruma_events_macros::BasicEventContent; use ruma_identifiers::RoomId; use serde::{Deserialize, Serialize}; +use super::Algorithm; +use crate::BasicEvent; + /// This event type is used to exchange keys for end-to-end encryption. /// /// Typically it is encrypted as an *m.room.encrypted* event, then sent as a to-device event. +pub type RoomKeyEvent = BasicEvent; + +/// The payload for `RoomKeyEvent`. #[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)] #[ruma_event(type = "m.room_key")] pub struct RoomKeyEventContent { diff --git a/src/sticker.rs b/src/sticker.rs index ca81e232..df6a4868 100644 --- a/src/sticker.rs +++ b/src/sticker.rs @@ -3,9 +3,12 @@ use ruma_events_macros::MessageEventContent; use serde::{Deserialize, Serialize}; -use crate::room::ImageInfo; +use crate::{room::ImageInfo, MessageEvent}; /// A sticker message. +pub type StickerEvent = MessageEvent; + +/// The payload for `StickerEvent`. #[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[ruma_event(type = "m.sticker")] pub struct StickerEventContent { diff --git a/src/typing.rs b/src/typing.rs index d3e846cd..a6fe6f7d 100644 --- a/src/typing.rs +++ b/src/typing.rs @@ -4,7 +4,12 @@ use ruma_events_macros::EphemeralRoomEventContent; use ruma_identifiers::UserId; use serde::{Deserialize, Serialize}; +use crate::EphemeralRoomEvent; + /// Informs the client who is currently typing in a given room. +pub type TypingEvent = EphemeralRoomEvent; + +/// The payload for `TypingEvent`. #[derive(Clone, Debug, Deserialize, Serialize, EphemeralRoomEventContent)] #[ruma_event(type = "m.typing")] pub struct TypingEventContent {