Convert m.room.create to the new API.

This commit is contained in:
Jimmy Cuadra 2019-06-22 00:10:03 -07:00
parent 5b505cc501
commit 0f49c5e7f6
3 changed files with 21 additions and 21 deletions

View File

@ -10,7 +10,7 @@ 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;

View File

@ -40,7 +40,7 @@ pub struct CanonicalAliasEvent {
pub unsigned: Option<Value>, pub unsigned: Option<Value>,
} }
/// The payload of a `CanonicalAliasEvent`. /// The payload for `CanonicalAliasEvent`.
#[derive(Clone, Debug, PartialEq, Serialize)] #[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CanonicalAliasEventContent { pub struct CanonicalAliasEventContent {
/// The canonical alias. /// The canonical alias.

View File

@ -2,21 +2,19 @@
use std::convert::TryFrom; use std::convert::TryFrom;
use js_int::UInt; use ruma_events_macros::ruma_event;
use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId}; use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::default_true; use crate::default_true;
state_event! { ruma_event! {
/// This is the first event in a room and cannot be changed. It acts as the root of all other /// This is the first event in a room and cannot be changed. It acts as the root of all other
/// events. /// events.
pub struct CreateEvent(CreateEventContent) {} CreateEvent {
} kind: StateEvent,
event_type: RoomCreate,
/// The payload of a `CreateEvent`. content: {
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CreateEventContent {
/// The `user_id` of the room creator. This is set by the homeserver. /// The `user_id` of the room creator. This is set by the homeserver.
pub creator: UserId, pub creator: UserId,
@ -31,6 +29,8 @@ pub struct CreateEventContent {
/// A reference to the room this room replaces, if the previous room was upgraded. /// A reference to the room this room replaces, if the previous room was upgraded.
pub predecessor: Option<PreviousRoom>, pub predecessor: Option<PreviousRoom>,
},
}
} }
/// A reference to an old room replaced during a room version upgrade. /// A reference to an old room replaced during a room version upgrade.