events: Generate event type aliases
This commit is contained in:
parent
f0dff1c29a
commit
120f1f3b2a
@ -7,7 +7,7 @@ use syn::{
|
||||
DeriveInput, Ident, LitStr, Token,
|
||||
};
|
||||
|
||||
use crate::event_parse::EventKind;
|
||||
use crate::event_parse::{EventKind, EventKindVariation};
|
||||
|
||||
mod kw {
|
||||
// This `content` field is kept when the event is redacted.
|
||||
@ -154,12 +154,16 @@ pub fn expand_event_content(
|
||||
});
|
||||
let marker_trait_impl =
|
||||
event_kind.map(|k| generate_marker_trait_impl(k, &input.ident, ruma_events)).transpose()?;
|
||||
let type_aliases = event_kind
|
||||
.map(|k| generate_event_type_aliases(k, &input.ident, &event_type.value(), ruma_events))
|
||||
.transpose()?;
|
||||
|
||||
Ok(quote! {
|
||||
#redacted_event_content
|
||||
#event_content_impl
|
||||
#static_event_content_impl
|
||||
#marker_trait_impl
|
||||
#type_aliases
|
||||
})
|
||||
}
|
||||
|
||||
@ -319,6 +323,47 @@ fn generate_redacted_event_content(
|
||||
})
|
||||
}
|
||||
|
||||
fn generate_event_type_aliases(
|
||||
event_kind: &EventKind,
|
||||
ident: &Ident,
|
||||
event_type: &str,
|
||||
ruma_events: &TokenStream,
|
||||
) -> syn::Result<TokenStream> {
|
||||
if ident == "RedactionEventContent" {
|
||||
return Ok(quote! {});
|
||||
}
|
||||
|
||||
let ident_s = ident.to_string();
|
||||
let ev_type_s = ident_s.strip_suffix("Content").ok_or_else(|| {
|
||||
syn::Error::new_spanned(ident, "Expected content struct name ending in `Content`")
|
||||
})?;
|
||||
|
||||
let ev_type = format_ident!("{}", ev_type_s);
|
||||
let ev_type_doc =
|
||||
format!("A `{}` event.\n\nFor more information, see [`{}`].", event_type, ident);
|
||||
let ev_struct = format_ident!("{}", event_kind);
|
||||
|
||||
let sync_type_alias =
|
||||
event_kind.to_event_ident(&EventKindVariation::Sync).map(|sync_ev_struct| {
|
||||
let sync_ev_type = format_ident!("Sync{}", ev_type_s);
|
||||
let sync_ev_type_doc = format!(
|
||||
"A `{}` event from a `sync_events` response.\n\nFor more information, see [`{}`].",
|
||||
event_type, ident,
|
||||
);
|
||||
|
||||
quote! {
|
||||
#[doc = #sync_ev_type_doc]
|
||||
pub type #sync_ev_type = #ruma_events::#sync_ev_struct<#ident>;
|
||||
}
|
||||
});
|
||||
|
||||
Ok(quote! {
|
||||
#[doc = #ev_type_doc]
|
||||
pub type #ev_type = #ruma_events::#ev_struct<#ident>;
|
||||
#sync_type_alias
|
||||
})
|
||||
}
|
||||
|
||||
fn generate_marker_trait_impl(
|
||||
event_kind: &EventKind,
|
||||
ident: &Ident,
|
||||
|
@ -5,12 +5,10 @@ use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::SessionDescription;
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of an `m.call.answer` event.
|
||||
///
|
||||
/// This event is sent by the callee when they wish to answer the call.
|
||||
pub type AnswerEvent = MessageEvent<AnswerEventContent>;
|
||||
|
||||
/// The payload for `AnswerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.call.answer", kind = Message)]
|
||||
|
@ -4,13 +4,10 @@ use js_int::UInt;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of an `m.call.candidates` 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.
|
||||
pub type CandidatesEvent = MessageEvent<CandidatesEventContent>;
|
||||
|
||||
/// The payload for `CandidatesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.call.candidates", kind = Message)]
|
||||
|
@ -5,13 +5,10 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of an `m.call.hangup` 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.
|
||||
pub type HangupEvent = MessageEvent<HangupEventContent>;
|
||||
|
||||
/// The payload for `HangupEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.call.hangup", kind = Message)]
|
||||
|
@ -5,12 +5,10 @@ use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::SessionDescription;
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of an `m.call.invite` event.
|
||||
///
|
||||
/// This event is sent by the caller when they wish to establish a call.
|
||||
pub type InviteEvent = MessageEvent<InviteEventContent>;
|
||||
|
||||
/// The payload for `InviteEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.call.invite", kind = Message)]
|
||||
|
@ -9,13 +9,12 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Informs the client about the rooms that are considered direct by a user.
|
||||
pub type DirectEvent = crate::GlobalAccountDataEvent<DirectEventContent>;
|
||||
|
||||
/// The payload for `DirectEvent`.
|
||||
/// The content of an `m.direct` event.
|
||||
///
|
||||
/// A mapping of `UserId`s to a list of `RoomId`s which are considered *direct* for that
|
||||
/// particular user.
|
||||
/// A mapping of `UserId`s to a list of `RoomId`s which are considered *direct* for that particular
|
||||
/// user.
|
||||
///
|
||||
/// Informs the client about the rooms that are considered direct by a user.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[allow(clippy::exhaustive_structs)]
|
||||
#[ruma_event(type = "m.direct", kind = GlobalAccountData)]
|
||||
|
@ -8,7 +8,7 @@ use serde::{
|
||||
ser::{Serialize, SerializeStruct as _, Serializer},
|
||||
};
|
||||
|
||||
/// The payload for `DummyEvent`.
|
||||
/// The content of an `m.dummy` event.
|
||||
///
|
||||
/// This event is used to indicate new Olm sessions for end-to-end encryption.
|
||||
///
|
||||
|
@ -4,7 +4,7 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{EventEncryptionAlgorithm, RoomId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The payload for `ForwardedRoomKeyEvent`.
|
||||
/// The content of an `m.forwarded_room_key` event.
|
||||
///
|
||||
/// To create an instance of this type, first create a `ForwardedRoomKeyToDeviceEventContentInit`
|
||||
/// and convert it via `ForwardedRoomKeyToDeviceEventContent::from` / `.into()`.
|
||||
|
@ -4,15 +4,11 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::EventId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::RoomAccountDataEvent;
|
||||
|
||||
/// The content of an `m.fully_read` event.
|
||||
///
|
||||
/// The current location of the user's read marker in a room.
|
||||
///
|
||||
/// This event appears in the user's room account data for the room the marker is applicable
|
||||
/// for.
|
||||
pub type FullyReadEvent = RoomAccountDataEvent<FullyReadEventContent>;
|
||||
|
||||
/// The payload for `FullyReadEvent`.
|
||||
/// This event appears in the user's room account data for the room the marker is applicable for.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.fully_read", kind = RoomAccountData)]
|
||||
|
@ -4,12 +4,9 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::GlobalAccountDataEvent;
|
||||
|
||||
/// The content of an `m.ignored_user_list` event.
|
||||
///
|
||||
/// A list of users to ignore.
|
||||
pub type IgnoredUserListEvent = GlobalAccountDataEvent<IgnoredUserListEventContent>;
|
||||
|
||||
/// The payload for `IgnoredUserListEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.ignored_user_list", kind = GlobalAccountData)]
|
||||
|
@ -11,15 +11,10 @@ use super::Relation;
|
||||
use super::{
|
||||
HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, ShortAuthenticationString,
|
||||
};
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of a to-device `m.key.verification.accept` event.
|
||||
///
|
||||
/// Accepts a previously sent *m.key.verification.start* message.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub type AcceptEvent = MessageEvent<AcceptEventContent>;
|
||||
|
||||
/// The payload for a to-device `AcceptEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.accept", kind = ToDevice)]
|
||||
@ -42,7 +37,9 @@ impl AcceptToDeviceEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for a in-room `AcceptEvent`.
|
||||
/// The content of a in-room `m.key.verification.accept` event.
|
||||
///
|
||||
/// Accepts a previously sent *m.key.verification.start* message.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.accept", kind = Message)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
|
@ -6,15 +6,10 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use super::Relation;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of a to-device `m.key.verification.cancel` event.
|
||||
///
|
||||
/// Cancels a key verification process/request.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub type CancelEvent = MessageEvent<CancelEventContent>;
|
||||
|
||||
/// The payload for a to-device `CancelEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.cancel", kind = ToDevice)]
|
||||
@ -38,7 +33,9 @@ impl CancelToDeviceEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for an in-room `CancelEvent`.
|
||||
/// The content of an in-room `m.key.verification.cancel` event.
|
||||
///
|
||||
/// Cancels a key verification process/request.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
|
@ -4,13 +4,10 @@ use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::Relation;
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// Event signaling that the interactive key verification has successfully
|
||||
/// concluded.
|
||||
pub type DoneEvent = MessageEvent<DoneEventContent>;
|
||||
|
||||
/// The payload for a to-device `m.key.verification.done` event.
|
||||
/// The content of a to-device `m.m.key.verification.done` event.
|
||||
///
|
||||
/// Event signaling that the interactive key verification has successfully concluded.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.done", kind = ToDevice)]
|
||||
@ -29,6 +26,8 @@ impl DoneToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for a in-room `m.key.verification.done` event.
|
||||
///
|
||||
/// Event signaling that the interactive key verification has successfully concluded.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.done", kind = Message)]
|
||||
|
@ -5,15 +5,10 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use super::Relation;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of a to-device `m.key.verification.key` event.
|
||||
///
|
||||
/// Sends the ephemeral public key for a device to the partner device.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub type KeyEvent = MessageEvent<KeyEventContent>;
|
||||
|
||||
/// The payload for a to-device `KeyEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.key", kind = ToDevice)]
|
||||
@ -34,7 +29,9 @@ impl KeyToDeviceEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for in-room `KeyEvent`.
|
||||
/// The content of an in-room `m.key.verification.key` event.
|
||||
///
|
||||
/// Sends the ephemeral public key for a device to the partner device.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
|
@ -7,15 +7,10 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use super::Relation;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of a to-device `m.key.verification.` event.
|
||||
///
|
||||
/// Sends the MAC of a device's key to the partner device.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub type MacEvent = MessageEvent<MacEventContent>;
|
||||
|
||||
/// The payload for a to-device `MacEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.mac", kind = ToDevice)]
|
||||
@ -43,7 +38,9 @@ impl MacToDeviceEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for an in-room `MacEvent`.
|
||||
/// The content of an in-room `m.key.verification.` event.
|
||||
///
|
||||
/// Sends the MAC of a device's key to the partner device.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
|
@ -5,12 +5,10 @@ use ruma_identifiers::DeviceIdBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{Relation, VerificationMethod};
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of a to-device `m.m.key.verification.ready` event.
|
||||
///
|
||||
/// Response to a previously sent *m.key.verification.request* message.
|
||||
pub type ReadyEvent = MessageEvent<ReadyEventContent>;
|
||||
|
||||
/// The payload for a to-device `m.key.verification.ready` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.ready", kind = ToDevice)]
|
||||
@ -41,7 +39,9 @@ impl ReadyToDeviceEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for an in-room `m.key.verification.ready` event.
|
||||
/// The content of an in-room `m.m.key.verification.ready` event.
|
||||
///
|
||||
/// Response to a previously sent *m.key.verification.request* message.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.ready", kind = Message)]
|
||||
|
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::VerificationMethod;
|
||||
|
||||
/// The payload for `RequestEvent`.
|
||||
/// The content of an `m.key.verification.request` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.request", kind = ToDevice)]
|
||||
|
@ -12,15 +12,10 @@ use super::Relation;
|
||||
use super::{
|
||||
HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, ShortAuthenticationString,
|
||||
};
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of a to-device `m.key.verification.start` event.
|
||||
///
|
||||
/// Begins an SAS key verification process.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub type StartEvent = MessageEvent<StartEventContent>;
|
||||
|
||||
/// The payload of a to-device *m.key.verification.start* event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.key.verification.start", kind = ToDevice)]
|
||||
@ -48,7 +43,9 @@ impl StartToDeviceEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload of an in-room *m.key.verification.start* event.
|
||||
/// The content of an in-room `m.key.verification.start` event.
|
||||
///
|
||||
/// Begins an SAS key verification process.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
|
@ -3,12 +3,11 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
use crate::policy::rule::PolicyRuleEventContent;
|
||||
|
||||
/// The content of an `m.policy.rule.room` event.
|
||||
///
|
||||
/// This event type is used to apply rules to room entities.
|
||||
pub type RoomEvent = StateEvent<RoomEventContent>;
|
||||
|
||||
/// The payload for `RoomEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[allow(clippy::exhaustive_structs)]
|
||||
#[ruma_event(type = "m.policy.rule.room", kind = State)]
|
||||
|
@ -3,12 +3,11 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
use crate::policy::rule::PolicyRuleEventContent;
|
||||
|
||||
/// The content of an `m.policy.rule.server` event.
|
||||
///
|
||||
/// This event type is used to apply rules to server entities.
|
||||
pub type ServerEvent = StateEvent<ServerEventContent>;
|
||||
|
||||
/// The payload for `ServerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[allow(clippy::exhaustive_structs)]
|
||||
#[ruma_event(type = "m.policy.rule.server", kind = State)]
|
||||
|
@ -3,12 +3,11 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
use crate::policy::rule::PolicyRuleEventContent;
|
||||
|
||||
/// The content of an `m.policy.rule.user` event.
|
||||
///
|
||||
/// This event type is used to apply rules to user entities.
|
||||
pub type UserEvent = StateEvent<UserEventContent>;
|
||||
|
||||
/// The payload for `UserEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[allow(clippy::exhaustive_structs)]
|
||||
#[ruma_event(type = "m.policy.rule.user", kind = State)]
|
||||
|
@ -4,12 +4,9 @@ use ruma_common::push::Ruleset;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::GlobalAccountDataEvent;
|
||||
|
||||
/// The content of an `m.push_rules` event.
|
||||
///
|
||||
/// Describes all push rules for a user.
|
||||
pub type PushRulesEvent = GlobalAccountDataEvent<PushRulesEventContent>;
|
||||
|
||||
/// The payload for `PushRulesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.push_rules", kind = GlobalAccountData)]
|
||||
|
@ -4,12 +4,9 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::EventId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The payload for a `m.reaction` event.
|
||||
///
|
||||
/// A reaction to another event.
|
||||
pub type ReactionEvent = MessageEvent<ReactionEventContent>;
|
||||
|
||||
/// The payload for a `ReactionEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.reaction", kind = Message)]
|
||||
|
@ -10,15 +10,12 @@ use ruma_events_macros::EventContent;
|
||||
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<ReceiptEventContent>;
|
||||
|
||||
/// The payload for `ReceiptEvent`.
|
||||
/// The content of an `m.receipt` event.
|
||||
///
|
||||
/// A mapping of event ID to a collection of receipts for this event ID. The event ID is the ID of
|
||||
/// the event being acknowledged and *not* an ID for the receipt itself.
|
||||
///
|
||||
/// Informs the client who has read a message specified by it's event id.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[allow(clippy::exhaustive_structs)]
|
||||
#[ruma_event(type = "m.receipt", kind = EphemeralRoom)]
|
||||
|
@ -7,13 +7,12 @@ use serde_json::value::RawValue as RawJsonValue;
|
||||
|
||||
use crate::{
|
||||
EventContent, HasDeserializeFields, RedactContent, RedactedEventContent,
|
||||
RedactedStateEventContent, StateEvent,
|
||||
RedactedStateEventContent,
|
||||
};
|
||||
|
||||
/// The content of an `m.room.aliases` event.
|
||||
///
|
||||
/// Informs the room about what room aliases it has been given.
|
||||
pub type AliasesEvent = StateEvent<AliasesEventContent>;
|
||||
|
||||
/// The payload for `AliasesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.aliases", kind = State, custom_redacted)]
|
||||
|
@ -6,14 +6,12 @@ use ruma_identifiers::MxcUri;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::ThumbnailInfo;
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.avatar` event.
|
||||
///
|
||||
/// A picture that is associated with the room.
|
||||
///
|
||||
/// This can be displayed alongside the room information.
|
||||
pub type AvatarEvent = StateEvent<AvatarEventContent>;
|
||||
|
||||
/// The payload for `AvatarEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[cfg_attr(feature = "unstable-pre-spec", derive(Default))]
|
||||
|
@ -4,12 +4,9 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::RoomAliasId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.canonical_alias` event.
|
||||
///
|
||||
/// Informs the room as to which alias is the canonical one.
|
||||
pub type CanonicalAliasEvent = StateEvent<CanonicalAliasEventContent>;
|
||||
|
||||
/// The payload for `CanonicalAliasEvent`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.canonical_alias", kind = State)]
|
||||
|
@ -5,14 +5,11 @@ use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId};
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.create` event.
|
||||
///
|
||||
/// This is the first event in a room and cannot be changed.
|
||||
///
|
||||
/// It acts as the root of all other events.
|
||||
pub type CreateEvent = StateEvent<CreateEventContent>;
|
||||
|
||||
/// The payload for `CreateEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.create", kind = State)]
|
||||
|
@ -9,19 +9,13 @@ use ruma_identifiers::DeviceIdBox;
|
||||
use ruma_identifiers::EventId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::room::message::{self, InReplyTo};
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::{key::verification, reaction};
|
||||
use crate::{
|
||||
room::message::{self, InReplyTo},
|
||||
MessageEvent,
|
||||
};
|
||||
|
||||
mod relation_serde;
|
||||
|
||||
/// An event that has been encrypted.
|
||||
pub type EncryptedEvent = MessageEvent<EncryptedEventContent>;
|
||||
|
||||
/// The content payload for `EncryptedEvent`.
|
||||
/// The content of an `m.room.encrypted` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encrypted", kind = Message, kind = ToDevice)]
|
||||
@ -50,7 +44,7 @@ impl From<EncryptedEventScheme> for EncryptedEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The to-device content payload for `m.encrypted` events.
|
||||
/// The to-device content of an `m.room.encrypted` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encrypted", kind = ToDevice)]
|
||||
@ -122,7 +116,7 @@ pub enum Relation {
|
||||
/// The event this relation belongs to replaces another event.
|
||||
///
|
||||
/// In contrast to [`message::Replacement`], this struct doesn't store the new content, since that
|
||||
/// is part of the encrypted payload for `m.encrypted` events.
|
||||
/// is part of the encrypted content of an `m.room.encrypted` events.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
@ -171,7 +165,7 @@ impl Annotation {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for `EncryptedEvent` using the *m.olm.v1.curve25519-aes-sha2* algorithm.
|
||||
/// The content of an `m.room.encrypted` event using the *m.olm.v1.curve25519-aes-sha2* algorithm.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct OlmV1Curve25519AesSha2Content {
|
||||
@ -210,7 +204,7 @@ impl CiphertextInfo {
|
||||
}
|
||||
}
|
||||
|
||||
/// The payload for `EncryptedEvent` using the *m.megolm.v1.aes-sha2* algorithm.
|
||||
/// The content of an `m.room.encrypted` event using the *m.megolm.v1.aes-sha2* algorithm.
|
||||
///
|
||||
/// To create an instance of this type, first create a `MegolmV1AesSha2ContentInit` and convert it
|
||||
/// via `MegolmV1AesSha2Content::from` / `.into()`.
|
||||
|
@ -4,12 +4,11 @@ use js_int::UInt;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{EventEncryptionAlgorithm, StateEvent};
|
||||
use crate::EventEncryptionAlgorithm;
|
||||
|
||||
/// The content of an `m.room.encryption` event.
|
||||
///
|
||||
/// Defines how messages sent in this room should be encrypted.
|
||||
pub type EncryptionEvent = StateEvent<EncryptionEventContent>;
|
||||
|
||||
/// The payload for `EncryptionEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encryption", kind = State)]
|
||||
|
@ -4,15 +4,12 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.guest_access` event.
|
||||
///
|
||||
/// Controls whether guest users are allowed to join rooms.
|
||||
///
|
||||
/// This event controls whether guest users are allowed to join rooms. If this event is absent,
|
||||
/// servers should act as if it is present and has the value `GuestAccess::Forbidden`.
|
||||
pub type GuestAccessEvent = StateEvent<GuestAccessEventContent>;
|
||||
|
||||
/// The payload for `GuestAccessEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.guest_access", kind = State)]
|
||||
|
@ -4,13 +4,10 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.history_visibility` event.
|
||||
///
|
||||
/// This event controls whether a member of a room can see the events that happened in a room
|
||||
/// from before they joined.
|
||||
pub type HistoryVisibilityEvent = StateEvent<HistoryVisibilityEventContent>;
|
||||
|
||||
/// The payload for `HistoryVisibilityEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.history_visibility", kind = State)]
|
||||
|
@ -16,12 +16,9 @@ use std::borrow::Cow;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.join_rules` event.
|
||||
///
|
||||
/// Describes how users are allowed to join the room.
|
||||
pub type JoinRulesEvent = StateEvent<JoinRulesEventContent>;
|
||||
|
||||
/// The payload for `JoinRulesEvent`.
|
||||
#[derive(Clone, Debug, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.join_rules", kind = State)]
|
||||
|
@ -7,8 +7,10 @@ use ruma_identifiers::{MxcUri, ServerNameBox, ServerSigningKeyId, UserId};
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{StateEvent, StrippedStateEvent, SyncStateEvent};
|
||||
use crate::{StrippedStateEvent, SyncStateEvent};
|
||||
|
||||
/// The content of an `m.room.member` event.
|
||||
///
|
||||
/// The current membership state of a user in the room.
|
||||
///
|
||||
/// Adjusts the membership state for a user in a room. It is preferable to use the membership
|
||||
@ -34,9 +36,6 @@ use crate::{StateEvent, StrippedStateEvent, SyncStateEvent};
|
||||
/// The membership for a given user can change over time. Previous membership can be retrieved
|
||||
/// from the `prev_content` object on an event. If not present, the user's previous membership
|
||||
/// must be assumed as leave.
|
||||
pub type MemberEvent = StateEvent<MemberEventContent>;
|
||||
|
||||
/// The payload for `MemberEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.member", kind = State)]
|
||||
|
@ -20,12 +20,11 @@ mod content_serde;
|
||||
pub mod feedback;
|
||||
mod relation_serde;
|
||||
|
||||
/// The content of an `m.room.message` event.
|
||||
///
|
||||
/// This event is used when sending messages in a room.
|
||||
///
|
||||
/// Messages are not limited to be text.
|
||||
pub type MessageEvent = crate::MessageEvent<MessageEventContent>;
|
||||
|
||||
/// The payload for `MessageEvent`.
|
||||
#[derive(Clone, Debug, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.message", kind = Message)]
|
||||
|
@ -5,15 +5,12 @@ use ruma_identifiers::EventId;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::MessageEvent;
|
||||
|
||||
/// The content of an `m.room.message.feedback` event.
|
||||
///
|
||||
/// An acknowledgement of a message.
|
||||
///
|
||||
/// N.B.: Usage of this event is discouraged in favor of the receipts module. Most clients will
|
||||
/// not recognize this event.
|
||||
pub type FeedbackEvent = MessageEvent<FeedbackEventContent>;
|
||||
|
||||
/// The payload for `FeedbackEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.message.feedback", kind = Message)]
|
||||
|
@ -4,12 +4,9 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::RoomNameBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.name` event.
|
||||
///
|
||||
/// The room name is a human-friendly string designed to be displayed to the end-user.
|
||||
pub type NameEvent = StateEvent<NameEventContent>;
|
||||
|
||||
/// The payload for `NameEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.name", kind = State)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
|
@ -4,12 +4,9 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::EventId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.pinned_events` event.
|
||||
///
|
||||
/// Used to "pin" particular events in a room for other participants to review later.
|
||||
pub type PinnedEventsEvent = StateEvent<PinnedEventsEventContent>;
|
||||
|
||||
/// The payload for `PinnedEventsEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.pinned_events", kind = State)]
|
||||
|
@ -8,14 +8,13 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{EventType, StateEvent};
|
||||
use crate::EventType;
|
||||
|
||||
use ruma_common::power_levels::NotificationPowerLevels;
|
||||
|
||||
/// The content of an `m.room.power_levels` event.
|
||||
///
|
||||
/// Defines the power levels (privileges) of users in the room.
|
||||
pub type PowerLevelsEvent = StateEvent<PowerLevelsEventContent>;
|
||||
|
||||
/// The payload for `PowerLevelsEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.power_levels", kind = State)]
|
||||
|
@ -3,12 +3,9 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.server_acl` event.
|
||||
///
|
||||
/// An event to indicate which servers are permitted to participate in the room.
|
||||
pub type ServerAclEvent = StateEvent<ServerAclEventContent>;
|
||||
|
||||
/// The payload for `ServerAclEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.server_acl", kind = State)]
|
||||
|
@ -3,16 +3,13 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.third_party_invite` event.
|
||||
///
|
||||
/// An invitation to a room issued to a third party identifier, rather than a matrix user ID.
|
||||
///
|
||||
/// Acts as an *m.room.member* invite event, where there isn't a target user_id to invite. This
|
||||
/// event contains a token and a public key whose private key must be used to sign the token.
|
||||
/// Any user who can present that signature may use this invitation to join the target room.
|
||||
pub type ThirdPartyInviteEvent = StateEvent<ThirdPartyInviteEventContent>;
|
||||
|
||||
/// The payload for `ThirdPartyInviteEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.third_party_invite", kind = State)]
|
||||
|
@ -4,13 +4,10 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.tombstone` event.
|
||||
///
|
||||
/// A state event signifying that a room has been upgraded to a different room version, and that
|
||||
/// clients should go there.
|
||||
pub type TombstoneEvent = StateEvent<TombstoneEventContent>;
|
||||
|
||||
/// The payload for `TombstoneEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.tombstone", kind = State)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
|
@ -3,12 +3,9 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.room.topic` event.
|
||||
///
|
||||
/// A topic is a short message detailing what is currently being discussed in the room.
|
||||
pub type TopicEvent = StateEvent<TopicEventContent>;
|
||||
|
||||
/// The payload for `TopicEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.topic", kind = State)]
|
||||
|
@ -4,7 +4,7 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{EventEncryptionAlgorithm, RoomId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The payload for `RoomKeyEvent`.
|
||||
/// The content of an `m.room_key` event.
|
||||
///
|
||||
/// Typically encrypted as an *m.room.encrypted* event, then sent as a to-device event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
|
@ -5,7 +5,7 @@ use ruma_identifiers::{DeviceIdBox, EventEncryptionAlgorithm, RoomId};
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The payload for `RoomKeyRequestEvent`.
|
||||
/// The content of an `m.room_key_request` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room_key_request", kind = ToDevice)]
|
||||
|
@ -7,14 +7,11 @@ use ruma_identifiers::DeviceIdBox;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{ser::SerializeStruct, Deserialize, Serialize};
|
||||
|
||||
use crate::ToDeviceEvent;
|
||||
|
||||
/// The content of an `m.secret.request` event.
|
||||
///
|
||||
/// Event sent by a client to request a secret from another device or to cancel a previous request.
|
||||
///
|
||||
/// It is sent as an unencrypted to-device event.
|
||||
pub type RequestToDeviceEvent = ToDeviceEvent<RequestToDeviceEventContent>;
|
||||
|
||||
/// The payload for RequestToDeviceEvent.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.secret.request", kind = ToDevice)]
|
||||
|
@ -3,15 +3,12 @@
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::ToDeviceEvent;
|
||||
|
||||
/// The content of an `m.secret.send` event.
|
||||
///
|
||||
/// An event sent by a client to share a secret with another device, in response to an
|
||||
/// `m.secret.request` event.
|
||||
///
|
||||
/// It must be encrypted as an `m.room.encrypted` event, then sent as a to-device event.
|
||||
pub type SendToDeviceEvent = ToDeviceEvent<SendToDeviceEventContent>;
|
||||
|
||||
/// The payload for `SendToDeviceEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.secret.send", kind = ToDevice)]
|
||||
|
@ -4,16 +4,13 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::ServerNameBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.space.child` event.
|
||||
///
|
||||
/// The admins of a space can advertise rooms and subspaces for their space by setting
|
||||
/// `m.space.child` state events.
|
||||
///
|
||||
/// The `state_key` is the ID of a child room or space, and the content must contain a `via` key
|
||||
/// which gives a list of candidate servers that can be used to join the room.
|
||||
pub type ChildEvent = StateEvent<ChildEventContent>;
|
||||
|
||||
/// The payload for `ChildEvent`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.space.child", kind = State)]
|
||||
|
@ -4,16 +4,13 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::ServerNameBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
|
||||
/// The content of an `m.space.parent` event.
|
||||
///
|
||||
/// Rooms can claim parents via the `m.space.parent` state event.
|
||||
///
|
||||
/// Similar to `m.space.child`, the `state_key` is the ID of the parent space, and the content must
|
||||
/// contain a `via` key which gives a list of candidate servers that can be used to join the
|
||||
/// parent.
|
||||
pub type ParentEvent = StateEvent<ParentEventContent>;
|
||||
|
||||
/// The payload for `ParentEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.space.parent", kind = State)]
|
||||
|
@ -4,12 +4,11 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::MxcUri;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{room::ImageInfo, MessageEvent};
|
||||
use crate::room::ImageInfo;
|
||||
|
||||
/// The content of an `m.sticker` event.
|
||||
///
|
||||
/// A sticker message.
|
||||
pub type StickerEvent = MessageEvent<StickerEventContent>;
|
||||
|
||||
/// The payload for `StickerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.sticker", kind = Message)]
|
||||
|
@ -6,15 +6,12 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_serde::deserialize_cow_str;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::RoomAccountDataEvent;
|
||||
|
||||
/// Informs the client of tags on a room.
|
||||
pub type TagEvent = RoomAccountDataEvent<TagEventContent>;
|
||||
|
||||
/// Map of tag names to tag info.
|
||||
pub type Tags = BTreeMap<TagName, TagInfo>;
|
||||
|
||||
/// The payload for `TagEvent`.
|
||||
/// The content of an `m.tag` event.
|
||||
///
|
||||
/// Informs the client of tags on a room.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.tag", kind = RoomAccountData)]
|
||||
|
@ -4,12 +4,9 @@ use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::EphemeralRoomEvent;
|
||||
|
||||
/// The content of an `m.typing` event.
|
||||
///
|
||||
/// Informs the client who is currently typing in a given room.
|
||||
pub type TypingEvent = EphemeralRoomEvent<TypingEventContent>;
|
||||
|
||||
/// The payload for `TypingEvent`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.typing", kind = EphemeralRoom)]
|
||||
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.macro.test", kind = State)]
|
||||
pub struct MacroTest {
|
||||
pub struct MacroTestContent {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user