diff --git a/src/call/answer.rs b/src/call/answer.rs index 48b5faea..ad30258c 100644 --- a/src/call/answer.rs +++ b/src/call/answer.rs @@ -1,24 +1,21 @@ //! Types for the *m.call.answer* event. use js_int::UInt; -use ruma_events_macros::ruma_event; +use ruma_events_macros::{FromRaw, MessageEventContent}; +use serde::Serialize; use super::SessionDescription; -ruma_event! { - /// This event is sent by the callee when they wish to answer the call. - AnswerEvent { - kind: RoomEvent, - event_type: "m.call.answer", - content: { - /// The VoIP session description object. The session description type must be *answer*. - pub answer: SessionDescription, +/// This event is sent by the callee when they wish to answer the call. +#[derive(Clone, Debug, Serialize, FromRaw, MessageEventContent)] +#[ruma_event(type = "m.call.answer")] +pub struct AnswerEventContenet { + /// The VoIP session description object. The session description type must be *answer*. + pub answer: SessionDescription, - /// The ID of the call this event relates to. - pub call_id: String, + /// The ID of the call this event relates to. + pub call_id: String, - /// The version of the VoIP specification this messages adheres to. - pub version: UInt, - }, - } + /// The version of the VoIP specification this messages adheres to. + pub version: UInt, } diff --git a/src/call/candidates.rs b/src/call/candidates.rs index e5319956..33b7a76d 100644 --- a/src/call/candidates.rs +++ b/src/call/candidates.rs @@ -1,27 +1,22 @@ //! Types for the *m.call.candidates* event. use js_int::UInt; -use ruma_events_macros::ruma_event; +use ruma_events_macros::{FromRaw, MessageEventContent}; use serde::{Deserialize, Serialize}; -ruma_event! { - /// This event is sent by callers after sending an invite and by the callee after answering. - /// Its purpose is to give the other party additional ICE candidates to try using to - /// communicate. - CandidatesEvent { - kind: RoomEvent, - event_type: "m.call.candidates", - content: { - /// The ID of the call this event relates to. - pub call_id: String, +/// This event is sent by callers after sending an invite and by the callee after answering. Its +/// purpose is to give the other party additional ICE candidates to try using to communicate. +#[derive(Clone, Debug, Serialize, FromRaw, MessageEventContent)] +#[ruma_event(type = "m.call.candidates")] +pub struct CandidatesEventContent { + /// The ID of the call this event relates to. + pub call_id: String, - /// A list of candidates. - pub candidates: Vec, + /// A list of candidates. + pub candidates: Vec, - /// The version of the VoIP specification this messages adheres to. - pub version: UInt, - }, - } + /// The version of the VoIP specification this messages adheres to. + pub version: UInt, } /// An ICE (Interactive Connectivity Establishment) candidate. diff --git a/src/call/hangup.rs b/src/call/hangup.rs index e04a8864..db32d6e9 100644 --- a/src/call/hangup.rs +++ b/src/call/hangup.rs @@ -1,28 +1,24 @@ //! Types for the *m.call.hangup* event. use js_int::UInt; -use ruma_events_macros::ruma_event; +use ruma_events_macros::{FromRaw, MessageEventContent}; use serde::{Deserialize, Serialize}; use strum::{Display, EnumString}; -ruma_event! { - /// Sent by either party to signal their termination of the call. This can be sent either once - /// the call has has been established or before to abort the call. - HangupEvent { - kind: RoomEvent, - event_type: "m.call.hangup", - content: { - /// The ID of the call this event relates to. - pub call_id: String, +/// Sent by either party to signal their termination of the call. This can be sent either once the +/// call has has been established or before to abort the call. +#[derive(Clone, Debug, Serialize, FromRaw, MessageEventContent)] +#[ruma_event(type = "m.call.hangup")] +pub struct HangupEventContent { + /// The ID of the call this event relates to. + pub call_id: String, - /// The version of the VoIP specification this messages adheres to. - pub version: UInt, + /// The version of the VoIP specification this messages adheres to. + pub version: UInt, - /// Optional error reason for the hangup. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - }, - } + /// Optional error reason for the hangup. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, } /// A reason for a hangup. diff --git a/src/call/invite.rs b/src/call/invite.rs index 16b21ea7..4a9a7685 100644 --- a/src/call/invite.rs +++ b/src/call/invite.rs @@ -1,29 +1,26 @@ //! Types for the *m.call.invite* event. use js_int::UInt; -use ruma_events_macros::ruma_event; +use ruma_events_macros::{FromRaw, MessageEventContent}; +use serde::Serialize; use super::SessionDescription; -ruma_event! { - /// This event is sent by the caller when they wish to establish a call. - InviteEvent { - kind: RoomEvent, - event_type: "m.call.invite", - content: { - /// A unique identifer for the call. - pub call_id: String, +/// This event is sent by the caller when they wish to establish a call. +#[derive(Clone, Debug, Serialize, FromRaw, MessageEventContent)] +#[ruma_event(type = "m.call.invite")] +pub struct InviteEventContent { + /// A unique identifer for the call. + pub call_id: String, - /// The time in milliseconds that the invite is valid for. Once the invite age exceeds this - /// value, clients should discard it. They should also no longer show the call as awaiting an - /// answer in the UI. - pub lifetime: UInt, + /// The time in milliseconds that the invite is valid for. Once the invite age exceeds this + /// value, clients should discard it. They should also no longer show the call as awaiting an + /// answer in the UI. + pub lifetime: UInt, - /// The session description object. The session description type must be *offer*. - pub offer: SessionDescription, + /// The session description object. The session description type must be *offer*. + pub offer: SessionDescription, - /// The version of the VoIP specification this messages adheres to. - pub version: UInt, - }, - } + /// The version of the VoIP specification this messages adheres to. + pub version: UInt, } diff --git a/src/sticker.rs b/src/sticker.rs index 78959ef2..dda09ee2 100644 --- a/src/sticker.rs +++ b/src/sticker.rs @@ -1,25 +1,22 @@ //! Types for the *m.sticker* event. -use ruma_events_macros::ruma_event; +use ruma_events_macros::{FromRaw, MessageEventContent}; +use serde::Serialize; use crate::room::ImageInfo; -ruma_event! { - /// A sticker message. - StickerEvent { - kind: RoomEvent, - event_type: "m.sticker", - content: { - /// A textual representation or associated description of the sticker image. This could - /// be the alt text of the original image, or a message to accompany and further - /// describe the sticker. - pub body: String, +/// A sticker message. +#[derive(Clone, Debug, Serialize, FromRaw, MessageEventContent)] +#[ruma_event(type = "m.sticker")] +pub struct StickerEventContent { + /// A textual representation or associated description of the sticker image. This could + /// be the alt text of the original image, or a message to accompany and further + /// describe the sticker. + pub body: String, - /// Metadata about the image referred to in `url` including a thumbnail representation. - pub info: ImageInfo, + /// Metadata about the image referred to in `url` including a thumbnail representation. + pub info: ImageInfo, - /// The URL to the sticker image. This must be a valid `mxc://` URI. - pub url: String, - }, - } + /// The URL to the sticker image. This must be a valid `mxc://` URI. + pub url: String, }