Convert m.room.{aliases ,avatar ,encryption ,guest_access,
history_visibility, join_rules, member, pinned_events, third_party_invite, tombstone, topic} to the new API.
This commit is contained in:
parent
22c15277a7
commit
4212c9f619
@ -101,7 +101,7 @@ mod raw {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{collections::HashMap, convert::TryFrom};
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
|
|
||||||
|
20
src/room.rs
20
src/room.rs
@ -7,25 +7,25 @@ use std::collections::HashMap;
|
|||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
// pub mod aliases;
|
pub mod aliases;
|
||||||
// pub mod avatar;
|
pub mod avatar;
|
||||||
// pub mod canonical_alias;
|
// pub mod canonical_alias;
|
||||||
// pub mod create;
|
// pub mod create;
|
||||||
// pub mod encrypted;
|
// pub mod encrypted;
|
||||||
// pub mod encryption;
|
pub mod encryption;
|
||||||
// pub mod guest_access;
|
pub mod guest_access;
|
||||||
// pub mod history_visibility;
|
pub mod history_visibility;
|
||||||
// pub mod join_rules;
|
pub mod join_rules;
|
||||||
// pub mod member;
|
// pub mod member;
|
||||||
// pub mod message;
|
// pub mod message;
|
||||||
// pub mod name;
|
// pub mod name;
|
||||||
// pub mod pinned_events;
|
pub mod pinned_events;
|
||||||
// pub mod power_levels;
|
// pub mod power_levels;
|
||||||
pub mod redaction;
|
pub mod redaction;
|
||||||
// pub mod server_acl;
|
// pub mod server_acl;
|
||||||
// pub mod third_party_invite;
|
pub mod third_party_invite;
|
||||||
// pub mod tombstone;
|
pub mod tombstone;
|
||||||
// pub mod topic;
|
pub mod topic;
|
||||||
|
|
||||||
/// Metadata about an image.
|
/// Metadata about an image.
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
//! Types for the *m.room.aliases* event.
|
//! Types for the *m.room.aliases* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::RoomAliasId;
|
use ruma_identifiers::RoomAliasId;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// Informs the room about what room aliases it has been given.
|
/// Informs the room about what room aliases it has been given.
|
||||||
pub struct AliasesEvent(AliasesEventContent) {}
|
AliasesEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomAliases,
|
||||||
/// The payload of an `AliasesEvent`.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// A list of room aliases.
|
||||||
pub struct AliasesEventContent {
|
pub aliases: Vec<RoomAliasId>,
|
||||||
/// A list of room aliases.
|
},
|
||||||
pub aliases: Vec<RoomAliasId>,
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,24 @@
|
|||||||
//! Types for the *m.room.avatar* event.
|
//! Types for the *m.room.avatar* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use super::ImageInfo;
|
use super::ImageInfo;
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// A picture that is associated with the room.
|
/// A picture that is associated with the room.
|
||||||
///
|
///
|
||||||
/// This can be displayed alongside the room information.
|
/// This can be displayed alongside the room information.
|
||||||
pub struct AvatarEvent(AvatarEventContent) {}
|
AvatarEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomAvatar,
|
||||||
|
content: {
|
||||||
|
/// Information about the avatar image.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub info: Option<ImageInfo>,
|
||||||
|
|
||||||
/// The payload of an `AvatarEvent`.
|
/// Information about the avatar thumbnail image.
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// URL of the avatar image.
|
||||||
pub struct AvatarEventContent {
|
pub url: String,
|
||||||
/// Information about the avatar image.
|
},
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
}
|
||||||
pub info: Option<ImageInfo>,
|
|
||||||
|
|
||||||
/// Information about the avatar thumbnail image.
|
|
||||||
/// URL of the avatar image.
|
|
||||||
pub url: String,
|
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
//! Types for the *m.room.encryption* event.
|
//! Types for the *m.room.encryption* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use serde::{Deserialize, Serialize};
|
use ruma_events_macros::ruma_event;
|
||||||
|
|
||||||
use crate::Algorithm;
|
use crate::Algorithm;
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// Defines how messages sent in this room should be encrypted.
|
/// Defines how messages sent in this room should be encrypted.
|
||||||
pub struct EncryptionEvent(EncryptionEventContent) {}
|
EncryptionEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomEncryption,
|
||||||
/// The payload of an *m.room.encryption* event.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// The encryption algorithm to be used to encrypt messages sent in this room.
|
||||||
pub struct EncryptionEventContent {
|
///
|
||||||
/// The encryption algorithm to be used to encrypt messages sent in this room.
|
/// Must be `m.megolm.v1.aes-sha2`.
|
||||||
///
|
pub algorithm: Algorithm,
|
||||||
/// Must be `m.megolm.v1.aes-sha2`.
|
|
||||||
pub algorithm: Algorithm,
|
/// How long the session should be used before changing it.
|
||||||
|
///
|
||||||
/// How long the session should be used before changing it.
|
/// 604800000 (a week) is the recommended default.
|
||||||
///
|
pub rotation_period_ms: Option<UInt>,
|
||||||
/// 604800000 (a week) is the recommended default.
|
|
||||||
pub rotation_period_ms: Option<UInt>,
|
/// How many messages should be sent before changing the session.
|
||||||
|
///
|
||||||
/// How many messages should be sent before changing the session.
|
/// 100 is the recommended default.
|
||||||
///
|
pub rotation_period_msgs: Option<UInt>,
|
||||||
/// 100 is the recommended default.
|
},
|
||||||
pub rotation_period_msgs: Option<UInt>,
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
//! Types for the *m.room.guest_access* event.
|
//! Types for the *m.room.guest_access* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// Controls whether guest users are allowed to join rooms.
|
/// 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,
|
/// 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`.
|
/// servers should act as if it is present and has the value `GuestAccess::Forbidden`.
|
||||||
pub struct GuestAccessEvent(GuestAccessEventContent) {}
|
GuestAccessEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomGuestAccess,
|
||||||
/// The payload of a `GuestAccessEvent`.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// A policy for guest user access to a room.
|
||||||
pub struct GuestAccessEventContent {
|
pub guest_access: GuestAccess,
|
||||||
/// A policy for guest user access to a room.
|
},
|
||||||
pub guest_access: GuestAccess,
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A policy for guest user access to a room.
|
/// A policy for guest user access to a room.
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
//! Types for the *m.room.history_visibility* event.
|
//! Types for the *m.room.history_visibility* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// This event controls whether a member of a room can see the events that happened in a room
|
/// This event controls whether a member of a room can see the events that happened in a room
|
||||||
/// from before they joined.
|
/// from before they joined.
|
||||||
pub struct HistoryVisibilityEvent(HistoryVisibilityEventContent) {}
|
HistoryVisibilityEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomHistoryVisibility,
|
||||||
/// The payload of a `HistoryVisibilityEvent`.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// Who can see the room history.
|
||||||
pub struct HistoryVisibilityEventContent {
|
pub history_visibility: HistoryVisibility,
|
||||||
/// Who can see the room history.
|
},
|
||||||
pub history_visibility: HistoryVisibility,
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Who can see a room's history.
|
/// Who can see a room's history.
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
//! Types for the *m.room.join_rules* event.
|
//! Types for the *m.room.join_rules* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// Describes how users are allowed to join the room.
|
/// Describes how users are allowed to join the room.
|
||||||
pub struct JoinRulesEvent(JoinRulesEventContent) {}
|
JoinRulesEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomJoinRules,
|
||||||
/// The payload of a `JoinRulesEvent`.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// The type of rules used for users wishing to join this room.
|
||||||
pub struct JoinRulesEventContent {
|
pub join_rule: JoinRule,
|
||||||
/// The type of rules used for users wishing to join this room.
|
},
|
||||||
pub join_rule: JoinRule,
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The rule used for users wishing to join this room.
|
/// The rule used for users wishing to join this room.
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
//! Types for the *m.room.member* event.
|
//! Types for the *m.room.member* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
use ruma_signatures::Signatures;
|
use ruma_signatures::Signatures;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// The current membership state of a user in the room.
|
/// 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
|
/// Adjusts the membership state for a user in a room. It is preferable to use the membership
|
||||||
@ -31,32 +32,32 @@ state_event! {
|
|||||||
/// The membership for a given user can change over time. Previous membership can be retrieved
|
/// 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
|
/// from the `prev_content` object on an event. If not present, the user's previous membership
|
||||||
/// must be assumed as leave.
|
/// must be assumed as leave.
|
||||||
pub struct MemberEvent(MemberEventContent) {}
|
MemberEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomMember,
|
||||||
|
content: {
|
||||||
|
/// The avatar URL for this user, if any. This is added by the homeserver.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub avatar_url: Option<String>,
|
||||||
|
|
||||||
/// The payload of a `MemberEvent`.
|
/// The display name for this user, if any. This is added by the homeserver.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub struct MemberEventContent {
|
pub displayname: Option<String>,
|
||||||
/// The avatar URL for this user, if any. This is added by the homeserver.
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub avatar_url: Option<String>,
|
|
||||||
|
|
||||||
/// The display name for this user, if any. This is added by the homeserver.
|
/// Flag indicating if the room containing this event was created
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
/// with the intention of being a direct chat.
|
||||||
pub displayname: Option<String>,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub is_direct: Option<bool>,
|
||||||
|
|
||||||
/// Flag indicating if the room containing this event was created
|
/// The membership state of this user.
|
||||||
/// with the intention of being a direct chat.
|
pub membership: MembershipState,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub is_direct: Option<bool>,
|
|
||||||
|
|
||||||
/// The membership state of this user.
|
/// If this member event is the successor to a third party invitation, this field will
|
||||||
pub membership: MembershipState,
|
/// contain information about that invitation.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
/// If this member event is the successor to a third party invitation, this field will contain
|
pub third_party_invite: Option<ThirdPartyInvite>,
|
||||||
/// information about that invitation.
|
},
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
}
|
||||||
pub third_party_invite: Option<ThirdPartyInvite>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The membership state of a user.
|
/// The membership state of a user.
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
//! Types for the *m.room.pinned_events* event.
|
//! Types for the *m.room.pinned_events* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::EventId;
|
use ruma_identifiers::EventId;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// Used to "pin" particular events in a room for other participants to review later.
|
/// Used to "pin" particular events in a room for other participants to review later.
|
||||||
pub struct PinnedEventsEvent(PinnedEventsContent) {}
|
PinnedEventsEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomPinnedEvents,
|
||||||
/// The payload of a `NameEvent`.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// An ordered list of event IDs to pin.
|
||||||
pub struct PinnedEventsContent {
|
pub pinned: Vec<EventId>,
|
||||||
/// An ordered list of event IDs to pin.
|
},
|
||||||
pub pinned: Vec<EventId>,
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -22,16 +21,16 @@ mod tests {
|
|||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_identifiers::{EventId, RoomId, UserId};
|
use ruma_identifiers::{EventId, RoomId, UserId};
|
||||||
use serde_json::{from_str, to_string};
|
use serde_json::to_string;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
room::pinned_events::{PinnedEventsContent, PinnedEventsEvent},
|
room::pinned_events::{PinnedEventsEvent, PinnedEventsEventContent},
|
||||||
Event, EventType, RoomEvent, StateEvent,
|
Event, RoomEvent, StateEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn serialization_deserialization() {
|
fn serialization_deserialization() {
|
||||||
let mut content: PinnedEventsContent = PinnedEventsContent { pinned: Vec::new() };
|
let mut content: PinnedEventsEventContent = PinnedEventsEventContent { pinned: Vec::new() };
|
||||||
|
|
||||||
content.pinned.push(EventId::new("example.com").unwrap());
|
content.pinned.push(EventId::new("example.com").unwrap());
|
||||||
content.pinned.push(EventId::new("example.com").unwrap());
|
content.pinned.push(EventId::new("example.com").unwrap());
|
||||||
@ -39,7 +38,6 @@ mod tests {
|
|||||||
let event = PinnedEventsEvent {
|
let event = PinnedEventsEvent {
|
||||||
content: content.clone(),
|
content: content.clone(),
|
||||||
event_id: EventId::new("example.com").unwrap(),
|
event_id: EventId::new("example.com").unwrap(),
|
||||||
event_type: EventType::RoomPinnedEvents,
|
|
||||||
origin_server_ts: UInt::try_from(1_432_804_485_886u64).unwrap(),
|
origin_server_ts: UInt::try_from(1_432_804_485_886u64).unwrap(),
|
||||||
prev_content: None,
|
prev_content: None,
|
||||||
room_id: Some(RoomId::new("example.com").unwrap()),
|
room_id: Some(RoomId::new("example.com").unwrap()),
|
||||||
@ -49,7 +47,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let serialized_event = to_string(&event).unwrap();
|
let serialized_event = to_string(&event).unwrap();
|
||||||
let parsed_event: PinnedEventsEvent = from_str(&serialized_event).unwrap();
|
let parsed_event = PinnedEventsEvent::from_str(&serialized_event).unwrap();
|
||||||
|
|
||||||
assert_eq!(parsed_event.event_id(), event.event_id());
|
assert_eq!(parsed_event.event_id(), event.event_id());
|
||||||
assert_eq!(parsed_event.room_id(), event.room_id());
|
assert_eq!(parsed_event.room_id(), event.room_id());
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
//! Types for the *m.room.third_party_invite* event.
|
//! Types for the *m.room.third_party_invite* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// An invitation to a room issued to a third party identifier, rather than a matrix user ID.
|
/// 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
|
/// 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
|
/// event contains a token and a public key whose private key must be used to sign the token.
|
||||||
/// user who can present that signature may use this invitation to join the target room.
|
/// Any user who can present that signature may use this invitation to join the target room.
|
||||||
pub struct ThirdPartyInviteEvent(ThirdPartyInviteEventContent) {}
|
ThirdPartyInviteEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomThirdPartyInvite,
|
||||||
|
content: {
|
||||||
|
/// A user-readable string which represents the user who has been invited.
|
||||||
|
pub display_name: String,
|
||||||
|
|
||||||
/// The payload of a `ThirdPartyInviteEvent`.
|
/// A URL which can be fetched to validate whether the key has been revoked.
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
pub key_validity_url: String,
|
||||||
pub struct ThirdPartyInviteEventContent {
|
|
||||||
/// A user-readable string which represents the user who has been invited.
|
|
||||||
pub display_name: String,
|
|
||||||
|
|
||||||
/// A URL which can be fetched to validate whether the key has been revoked.
|
/// A Base64-encoded Ed25519 key with which the token must be signed.
|
||||||
pub key_validity_url: String,
|
pub public_key: String,
|
||||||
|
|
||||||
/// A Base64-encoded Ed25519 key with which the token must be signed.
|
/// Keys with which the token may be signed.
|
||||||
pub public_key: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub public_keys: Option<Vec<PublicKey>>,
|
||||||
/// Keys with which the token may be signed.
|
},
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
}
|
||||||
pub public_keys: Option<Vec<PublicKey>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A public key for signing a third party invite token.
|
/// A public key for signing a third party invite token.
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
//! Types for the *m.room.tombstone* event.
|
//! Types for the *m.room.tombstone* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use ruma_identifiers::RoomId;
|
use ruma_identifiers::RoomId;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// A state event signifying that a room has been upgraded to a different room version, and that
|
/// A state event signifying that a room has been upgraded to a different room version, and that
|
||||||
/// clients should go there.
|
/// clients should go there.
|
||||||
pub struct TombstoneEvent(TombstoneEventContent) {}
|
TombstoneEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomTombstone,
|
||||||
|
content: {
|
||||||
|
/// A server-defined message.
|
||||||
|
pub body: String,
|
||||||
|
|
||||||
/// The payload of an *m.room.tombstone* event.
|
/// The new room the client should be visiting.
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
pub replacement_room: RoomId,
|
||||||
pub struct TombstoneEventContent {
|
},
|
||||||
/// A server-defined message.
|
}
|
||||||
pub body: String,
|
|
||||||
|
|
||||||
/// The new room the client should be visiting.
|
|
||||||
pub replacement_room: RoomId,
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
//! Types for the *m.room.topic* event.
|
//! Types for the *m.room.topic* event.
|
||||||
|
|
||||||
use js_int::UInt;
|
use ruma_events_macros::ruma_event;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
state_event! {
|
ruma_event! {
|
||||||
/// A topic is a short message detailing what is currently being discussed in the room.
|
/// A topic is a short message detailing what is currently being discussed in the room.
|
||||||
pub struct TopicEvent(TopicEventContent) {}
|
TopicEvent {
|
||||||
}
|
kind: StateEvent,
|
||||||
|
event_type: RoomTopic,
|
||||||
/// The payload of a `TopicEvent`.
|
content: {
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
/// The topic text.
|
||||||
pub struct TopicEventContent {
|
pub topic: String,
|
||||||
/// The topic text.
|
},
|
||||||
pub topic: String,
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user