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,16 +1,15 @@
|
|||||||
//! 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",
|
|
||||||
content: {
|
|
||||||
/// The VoIP session description object. The session description type must be *answer*.
|
/// The VoIP session description object. The session description type must be *answer*.
|
||||||
pub answer: SessionDescription,
|
pub answer: SessionDescription,
|
||||||
|
|
||||||
@ -19,6 +18,4 @@ ruma_event! {
|
|||||||
|
|
||||||
/// 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,17 +1,14 @@
|
|||||||
//! 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,
|
|
||||||
event_type: "m.call.candidates",
|
|
||||||
content: {
|
|
||||||
/// 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,
|
||||||
|
|
||||||
@ -20,8 +17,6 @@ ruma_event! {
|
|||||||
|
|
||||||
/// 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,17 +1,15 @@
|
|||||||
//! 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",
|
|
||||||
content: {
|
|
||||||
/// 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,
|
||||||
|
|
||||||
@ -21,8 +19,6 @@ ruma_event! {
|
|||||||
/// 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,16 +1,15 @@
|
|||||||
//! 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",
|
|
||||||
content: {
|
|
||||||
/// A unique identifer for the call.
|
/// A unique identifer for the call.
|
||||||
pub call_id: String,
|
pub call_id: String,
|
||||||
|
|
||||||
@ -24,6 +23,4 @@ ruma_event! {
|
|||||||
|
|
||||||
/// 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,15 +1,14 @@
|
|||||||
//! 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",
|
|
||||||
content: {
|
|
||||||
/// A textual representation or associated description of the sticker image. This could
|
/// 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
|
/// be the alt text of the original image, or a message to accompany and further
|
||||||
/// describe the sticker.
|
/// describe the sticker.
|
||||||
@ -20,6 +19,4 @@ ruma_event! {
|
|||||||
|
|
||||||
/// 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