Convert most message events from ruma_event! to derive(MessageEventContent)
* m.sticker * m.call.answer * m.call.candidates * m.call.hangup * m.call.invite
This commit is contained in:
parent
80ff10ae6a
commit
24f720d1f1
@ -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,
|
||||
}
|
||||
|
@ -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<Candidate>,
|
||||
/// A list of candidates.
|
||||
pub candidates: Vec<Candidate>,
|
||||
|
||||
/// 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.
|
||||
|
@ -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<Reason>,
|
||||
},
|
||||
}
|
||||
/// Optional error reason for the hangup.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reason: Option<Reason>,
|
||||
}
|
||||
|
||||
/// A reason for a hangup.
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user