Move all content declarations to content trait attribute
This commit is contained in:
parent
c7c1251f3f
commit
8252a1a32c
@ -1,7 +1,7 @@
|
||||
//! Types for the *m.call.answer* event.
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::SessionDescription;
|
||||
@ -11,9 +11,9 @@ use crate::MessageEvent;
|
||||
pub type AnswerEvent = MessageEvent<AnswerEventContent>;
|
||||
|
||||
/// The payload for `AnswerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.call.answer")]
|
||||
#[ruma_event(type = "m.call.answer", kind = Message)]
|
||||
pub struct AnswerEventContent {
|
||||
/// The VoIP session description object. The session description type must be *answer*.
|
||||
pub answer: SessionDescription,
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Types for the *m.call.candidates* event.
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::MessageEvent;
|
||||
@ -11,8 +11,8 @@ use crate::MessageEvent;
|
||||
pub type CandidatesEvent = MessageEvent<CandidatesEventContent>;
|
||||
|
||||
/// The payload for `CandidatesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.call.candidates")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.call.candidates", kind = Message)]
|
||||
pub struct CandidatesEventContent {
|
||||
/// The ID of the call this event relates to.
|
||||
pub call_id: String,
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Types for the *m.call.hangup* event.
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -12,8 +12,8 @@ use crate::MessageEvent;
|
||||
pub type HangupEvent = MessageEvent<HangupEventContent>;
|
||||
|
||||
/// The payload for `HangupEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.call.hangup")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.call.hangup", kind = Message)]
|
||||
pub struct HangupEventContent {
|
||||
/// The ID of the call this event relates to.
|
||||
pub call_id: String,
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Types for the *m.call.invite* event.
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::SessionDescription;
|
||||
@ -11,8 +11,8 @@ use crate::MessageEvent;
|
||||
pub type InviteEvent = MessageEvent<InviteEventContent>;
|
||||
|
||||
/// The payload for `InviteEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.call.invite")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.call.invite", kind = Message)]
|
||||
pub struct InviteEventContent {
|
||||
/// A unique identifier for the call.
|
||||
pub call_id: String,
|
||||
|
@ -3,8 +3,6 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value as JsonValue;
|
||||
|
||||
@ -37,8 +35,8 @@ pub struct AcceptToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for a in-room `AcceptEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.accept")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.accept", kind = Message)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub struct AcceptEventContent {
|
||||
|
@ -1,8 +1,6 @@
|
||||
//! Types for the *m.key.verification.cancel* event.
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -33,8 +31,8 @@ pub struct CancelToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for an in-room `CancelEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.cancel")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.cancel", kind = Message)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub struct CancelEventContent {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.key.verification.done* event.
|
||||
|
||||
use ruma_events_macros::{EventContent, MessageEventContent};
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::Relation;
|
||||
@ -21,8 +21,8 @@ pub struct DoneToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for a in-room `m.key.verification.done` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.done")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.done", kind = Message)]
|
||||
pub struct DoneEventContent {
|
||||
/// Relation signaling which verification request this event is responding
|
||||
/// to.
|
||||
|
@ -1,8 +1,6 @@
|
||||
//! Types for the *m.key.verification.key* event.
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
@ -29,8 +27,8 @@ pub struct KeyToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for in-room `KeyEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.key")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.key", kind = Message)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub struct KeyEventContent {
|
||||
|
@ -3,8 +3,6 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
@ -37,8 +35,8 @@ pub struct MacToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for an in-room `MacEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.mac")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.mac", kind = Message)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub struct MacEventContent {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.key.verification.ready* event.
|
||||
|
||||
use ruma_events_macros::{EventContent, MessageEventContent};
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::DeviceIdBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -29,8 +29,8 @@ pub struct ReadyToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload for an in-room `m.key.verification.ready` event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.ready")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.ready", kind = Message)]
|
||||
pub struct ReadyEventContent {
|
||||
/// The device ID which is initiating the request.
|
||||
pub from_device: DeviceIdBox,
|
||||
|
@ -3,8 +3,6 @@
|
||||
use std::{collections::BTreeMap, convert::TryFrom};
|
||||
|
||||
use ruma_events_macros::EventContent;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_identifiers::DeviceIdBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value as JsonValue;
|
||||
@ -43,8 +41,8 @@ pub struct StartToDeviceEventContent {
|
||||
}
|
||||
|
||||
/// The payload of an in-room *m.key.verification.start* event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.key.verification.start")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.key.verification.start", kind = Message)]
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
pub struct StartEventContent {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.policy.rule.room* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
@ -9,8 +9,8 @@ use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
pub type RoomEvent = StateEvent<RoomEventContent>;
|
||||
|
||||
/// The payload for `RoomEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.policy.rule.room")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.policy.rule.room", kind = State)]
|
||||
pub struct RoomEventContent(pub PolicyRuleEventContent);
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.policy.rule.server* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
@ -9,6 +9,6 @@ use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
pub type ServerEvent = StateEvent<ServerEventContent>;
|
||||
|
||||
/// The payload for `ServerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.policy.rule.server")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.policy.rule.server", kind = State)]
|
||||
pub struct ServerEventContent(pub PolicyRuleEventContent);
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.policy.rule.user* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
@ -9,6 +9,6 @@ use crate::{policy::rule::PolicyRuleEventContent, StateEvent};
|
||||
pub type UserEvent = StateEvent<UserEventContent>;
|
||||
|
||||
/// The payload for `UserEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.policy.rule.user")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.policy.rule.user", kind = State)]
|
||||
pub struct UserEventContent(pub PolicyRuleEventContent);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::EventId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -15,8 +15,8 @@ use crate::{
|
||||
pub type ReactionEvent = MessageEvent<ReactionEventContent>;
|
||||
|
||||
/// The payload for a `ReactionEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[ruma_event(type = "m.reaction")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.reaction", kind = Message)]
|
||||
pub struct ReactionEventContent {
|
||||
/// Information about the related event.
|
||||
#[serde(rename = "m.relates_to")]
|
||||
|
@ -6,7 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use ruma_common::{receipt::ReceiptType, MilliSecondsSinceUnixEpoch};
|
||||
use ruma_events_macros::EphemeralRoomEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{EventId, UserId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -19,8 +19,8 @@ pub type ReceiptEvent = EphemeralRoomEvent<ReceiptEventContent>;
|
||||
///
|
||||
/// 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.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EphemeralRoomEventContent)]
|
||||
#[ruma_event(type = "m.receipt")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.receipt", kind = EphemeralRoom)]
|
||||
pub struct ReceiptEventContent(pub BTreeMap<EventId, Receipts>);
|
||||
|
||||
impl Deref for ReceiptEventContent {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.aliases* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{RoomAliasId, RoomVersionId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::value::RawValue as RawJsonValue;
|
||||
@ -13,9 +13,9 @@ use crate::{
|
||||
pub type AliasesEvent = StateEvent<AliasesEventContent>;
|
||||
|
||||
/// The payload for `AliasesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.aliases", custom_redacted)]
|
||||
#[ruma_event(type = "m.room.aliases", kind = State, custom_redacted)]
|
||||
pub struct AliasesEventContent {
|
||||
/// A list of room aliases.
|
||||
pub aliases: Vec<RoomAliasId>,
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Types for the *m.room.avatar* event.
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::MxcUri;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -14,10 +14,10 @@ use crate::StateEvent;
|
||||
pub type AvatarEvent = StateEvent<AvatarEventContent>;
|
||||
|
||||
/// The payload for `AvatarEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[cfg_attr(feature = "unstable-pre-spec", derive(Default))]
|
||||
#[ruma_event(type = "m.room.avatar")]
|
||||
#[ruma_event(type = "m.room.avatar", kind = State)]
|
||||
pub struct AvatarEventContent {
|
||||
/// Information about the avatar image.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.canonical_alias* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::RoomAliasId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -10,9 +10,9 @@ use crate::StateEvent;
|
||||
pub type CanonicalAliasEvent = StateEvent<CanonicalAliasEventContent>;
|
||||
|
||||
/// The payload for `CanonicalAliasEvent`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.canonical_alias")]
|
||||
#[ruma_event(type = "m.room.canonical_alias", kind = State)]
|
||||
pub struct CanonicalAliasEventContent {
|
||||
/// The canonical alias.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.create* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -11,9 +11,9 @@ use crate::StateEvent;
|
||||
pub type CreateEvent = StateEvent<CreateEventContent>;
|
||||
|
||||
/// The payload for `CreateEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.create")]
|
||||
#[ruma_event(type = "m.room.create", kind = State)]
|
||||
pub struct CreateEventContent {
|
||||
/// The `user_id` of the room creator. This is set by the homeserver.
|
||||
#[ruma_event(skip_redaction)]
|
||||
|
@ -3,7 +3,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::DeviceIdBox;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -27,9 +27,9 @@ pub enum EncryptedEventScheme {
|
||||
}
|
||||
|
||||
/// The content payload for `EncryptedEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encrypted")]
|
||||
#[ruma_event(type = "m.room.encrypted", kind = Message, kind = ToDevice)]
|
||||
pub struct EncryptedEventContent {
|
||||
/// Encrypted event content
|
||||
#[serde(flatten)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Types for the *m.room.encryption* event.
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{EventEncryptionAlgorithm, StateEvent};
|
||||
@ -10,9 +10,9 @@ use crate::{EventEncryptionAlgorithm, StateEvent};
|
||||
pub type EncryptionEvent = StateEvent<EncryptionEventContent>;
|
||||
|
||||
/// The payload for `EncryptionEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encryption")]
|
||||
#[ruma_event(type = "m.room.encryption", kind = State)]
|
||||
pub struct EncryptionEventContent {
|
||||
/// The encryption algorithm to be used to encrypt messages sent in this room.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.guest_access* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -13,9 +13,9 @@ use crate::StateEvent;
|
||||
pub type GuestAccessEvent = StateEvent<GuestAccessEventContent>;
|
||||
|
||||
/// The payload for `GuestAccessEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.guest_access")]
|
||||
#[ruma_event(type = "m.room.guest_access", kind = State)]
|
||||
pub struct GuestAccessEventContent {
|
||||
/// A policy for guest user access to a room.
|
||||
pub guest_access: GuestAccess,
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.history_visibility* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -11,9 +11,9 @@ use crate::StateEvent;
|
||||
pub type HistoryVisibilityEvent = StateEvent<HistoryVisibilityEventContent>;
|
||||
|
||||
/// The payload for `HistoryVisibilityEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.history_visibility")]
|
||||
#[ruma_event(type = "m.room.history_visibility", kind = State)]
|
||||
pub struct HistoryVisibilityEventContent {
|
||||
/// Who can see the room history.
|
||||
#[ruma_event(skip_redaction)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.join_rules* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -10,9 +10,9 @@ use crate::StateEvent;
|
||||
pub type JoinRulesEvent = StateEvent<JoinRulesEventContent>;
|
||||
|
||||
/// The payload for `JoinRulesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.join_rules")]
|
||||
#[ruma_event(type = "m.room.join_rules", kind = State)]
|
||||
pub struct JoinRulesEventContent {
|
||||
/// The type of rules used for users wishing to join this room.
|
||||
#[ruma_event(skip_redaction)]
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::{MxcUri, ServerNameBox, ServerSigningKeyId, UserId};
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -37,8 +37,8 @@ use crate::{StateEvent, StrippedStateEvent, SyncStateEvent};
|
||||
pub type MemberEvent = StateEvent<MemberEventContent>;
|
||||
|
||||
/// The payload for `MemberEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.member")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.member", kind = State)]
|
||||
pub struct MemberEventContent {
|
||||
/// The avatar URL for this user, if any. This is added by the homeserver.
|
||||
///
|
||||
|
@ -4,7 +4,7 @@ use std::borrow::Cow;
|
||||
|
||||
use indoc::formatdoc;
|
||||
use js_int::UInt;
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::MxcUri;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use ruma_identifiers::{DeviceIdBox, UserId};
|
||||
@ -32,9 +32,9 @@ type JsonObject = serde_json::Map<String, JsonValue>;
|
||||
pub type MessageEvent = crate::MessageEvent<MessageEventContent>;
|
||||
|
||||
/// The payload for `MessageEvent`.
|
||||
#[derive(Clone, Debug, Serialize, MessageEventContent)]
|
||||
#[derive(Clone, Debug, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.message")]
|
||||
#[ruma_event(type = "m.room.message", kind = Message)]
|
||||
pub struct MessageEventContent {
|
||||
/// A key which identifies the type of message being sent.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.message.feedback* event.
|
||||
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::EventId;
|
||||
use ruma_serde::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -14,9 +14,9 @@ use crate::MessageEvent;
|
||||
pub type FeedbackEvent = MessageEvent<FeedbackEventContent>;
|
||||
|
||||
/// The payload for `FeedbackEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.message.feedback")]
|
||||
#[ruma_event(type = "m.room.message.feedback", kind = Message)]
|
||||
pub struct FeedbackEventContent {
|
||||
/// The event that this feedback is related to.
|
||||
pub target_event_id: EventId,
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.name* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{InvalidInput, StateEvent};
|
||||
@ -9,8 +9,8 @@ use crate::{InvalidInput, StateEvent};
|
||||
pub type NameEvent = StateEvent<NameEventContent>;
|
||||
|
||||
/// The payload for `NameEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.name")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.name", kind = State)]
|
||||
pub struct NameEventContent {
|
||||
/// The name of the room. This MUST NOT exceed 255 bytes.
|
||||
#[serde(default, deserialize_with = "room_name")]
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.pinned_events* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::EventId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -10,9 +10,9 @@ use crate::StateEvent;
|
||||
pub type PinnedEventsEvent = StateEvent<PinnedEventsEventContent>;
|
||||
|
||||
/// The payload for `PinnedEventsEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.pinned_events")]
|
||||
#[ruma_event(type = "m.room.pinned_events", kind = State)]
|
||||
pub struct PinnedEventsEventContent {
|
||||
/// An ordered list of event IDs to pin.
|
||||
pub pinned: Vec<EventId>,
|
||||
|
@ -4,7 +4,7 @@ use std::collections::BTreeMap;
|
||||
|
||||
use js_int::{int, Int};
|
||||
use ruma_common::power_levels::default_power_level;
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -16,8 +16,8 @@ pub use ruma_common::power_levels::NotificationPowerLevels;
|
||||
pub type PowerLevelsEvent = StateEvent<PowerLevelsEventContent>;
|
||||
|
||||
/// The payload for `PowerLevelsEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.power_levels")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.power_levels", kind = State)]
|
||||
pub struct PowerLevelsEventContent {
|
||||
/// The level required to ban a user.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.server_acl* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
@ -9,8 +9,8 @@ use crate::StateEvent;
|
||||
pub type ServerAclEvent = StateEvent<ServerAclEventContent>;
|
||||
|
||||
/// The payload for `ServerAclEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.server_acl")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.server_acl", kind = State)]
|
||||
pub struct ServerAclEventContent {
|
||||
/// True to allow server names that are IP address literals. False to deny.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.third_party_invite* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
@ -13,8 +13,8 @@ use crate::StateEvent;
|
||||
pub type ThirdPartyInviteEvent = StateEvent<ThirdPartyInviteEventContent>;
|
||||
|
||||
/// The payload for `ThirdPartyInviteEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.third_party_invite")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.third_party_invite", kind = State)]
|
||||
pub struct ThirdPartyInviteEventContent {
|
||||
/// A user-readable string which represents the user who has been invited.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.tombstone* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -11,8 +11,8 @@ use crate::StateEvent;
|
||||
pub type TombstoneEvent = StateEvent<TombstoneEventContent>;
|
||||
|
||||
/// The payload for `TombstoneEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.tombstone")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.tombstone", kind = State)]
|
||||
pub struct TombstoneEventContent {
|
||||
/// A server-defined message.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.room.topic* event.
|
||||
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::StateEvent;
|
||||
@ -9,8 +9,8 @@ use crate::StateEvent;
|
||||
pub type TopicEvent = StateEvent<TopicEventContent>;
|
||||
|
||||
/// The payload for `TopicEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.room.topic")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.room.topic", kind = State)]
|
||||
pub struct TopicEventContent {
|
||||
/// The topic text.
|
||||
pub topic: String,
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.sticker* event.
|
||||
|
||||
use ruma_events_macros::MessageEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::MxcUri;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -10,9 +10,9 @@ use crate::{room::ImageInfo, MessageEvent};
|
||||
pub type StickerEvent = MessageEvent<StickerEventContent>;
|
||||
|
||||
/// The payload for `StickerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.sticker")]
|
||||
#[ruma_event(type = "m.sticker", kind = Message)]
|
||||
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
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Types for the *m.typing* event.
|
||||
|
||||
use ruma_events_macros::EphemeralRoomEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -10,9 +10,9 @@ use crate::EphemeralRoomEvent;
|
||||
pub type TypingEvent = EphemeralRoomEvent<TypingEventContent>;
|
||||
|
||||
/// The payload for `TypingEvent`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EphemeralRoomEventContent)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.typing")]
|
||||
#[ruma_event(type = "m.typing", kind = EphemeralRoom)]
|
||||
pub struct TypingEventContent {
|
||||
/// The list of user IDs typing in this room, if any.
|
||||
pub user_ids: Vec<UserId>,
|
||||
|
@ -1,8 +1,8 @@
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(type = "m.macro.test")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(type = "m.macro.test", kind = State)]
|
||||
pub struct MacroTest {
|
||||
pub url: String,
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
pub struct MacroTest {
|
||||
pub url: String,
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error: no event type attribute found, add `#[ruma_event(type = "any.room.event")]` below the event content derive
|
||||
error: no event type attribute found, add `#[ruma_event(type = "any.room.event", kind = Kind)]` below the event content derive
|
||||
--> $DIR/02-no-event-type.rs:4:48
|
||||
|
|
||||
4 | #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
4 | #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
@ -1,14 +1,14 @@
|
||||
use ruma_events_macros::StateEventContent;
|
||||
use ruma_events_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[not_ruma_event(type = "m.macro.test")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[not_ruma_event(type = "m.macro.test", kind = State)]
|
||||
pub struct MacroTest {
|
||||
pub test: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
#[ruma_event(event = "m.macro.test")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[ruma_event(event = "m.macro.test", kind = State)]
|
||||
pub struct MoreMacroTest {
|
||||
pub test: String,
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
error: no event type attribute found, add `#[ruma_event(type = "any.room.event")]` below the event content derive
|
||||
error: no event type attribute found, add `#[ruma_event(type = "any.room.event", kind = Kind)]` below the event content derive
|
||||
--> $DIR/03-invalid-event-type.rs:4:48
|
||||
|
|
||||
4 | #[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
4 | #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of: `type`, `skip_redaction`, `custom_redacted`
|
||||
error: expected one of: `type`, `kind`, `skip_redaction`, `custom_redacted`
|
||||
--> $DIR/03-invalid-event-type.rs:11:14
|
||||
|
|
||||
11 | #[ruma_event(event = "m.macro.test")]
|
||||
11 | #[ruma_event(event = "m.macro.test", kind = State)]
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find attribute `not_ruma_event` in this scope
|
||||
--> $DIR/03-invalid-event-type.rs:5:3
|
||||
|
|
||||
5 | #[not_ruma_event(type = "m.macro.test")]
|
||||
5 | #[not_ruma_event(type = "m.macro.test", kind = State)]
|
||||
| ^^^^^^^^^^^^^^ help: a derive helper attribute with a similar name exists: `ruma_event`
|
||||
|
Loading…
x
Reference in New Issue
Block a user