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