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 avatar;
pub mod canonical_alias;
// pub mod create;
pub mod create;
// pub mod encrypted;
pub mod encryption;
pub mod guest_access;

View File

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

View File

@ -2,35 +2,35 @@
use std::convert::TryFrom;
use js_int::UInt;
use ruma_events_macros::ruma_event;
use ruma_identifiers::{EventId, RoomId, RoomVersionId, UserId};
use serde::{Deserialize, Serialize};
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
/// events.
pub struct CreateEvent(CreateEventContent) {}
}
CreateEvent {
kind: StateEvent,
event_type: RoomCreate,
content: {
/// The `user_id` of the room creator. This is set by the homeserver.
pub creator: UserId,
/// The payload of a `CreateEvent`.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CreateEventContent {
/// The `user_id` of the room creator. This is set by the homeserver.
pub creator: UserId,
/// Whether or not this room's data should be transferred to other homeservers.
#[serde(rename = "m.federate")]
#[serde(default = "default_true")]
pub federate: bool,
/// Whether or not this room's data should be transferred to other homeservers.
#[serde(rename = "m.federate")]
#[serde(default = "default_true")]
pub federate: bool,
/// The version of the room. Defaults to "1" if the key does not exist.
#[serde(default = "default_room_version_id")]
pub room_version: RoomVersionId,
/// The version of the room. Defaults to "1" if the key does not exist.
#[serde(default = "default_room_version_id")]
pub room_version: RoomVersionId,
/// A reference to the room this room replaces, if the previous room was upgraded.
pub predecessor: Option<PreviousRoom>,
/// A reference to the room this room replaces, if the previous room was upgraded.
pub predecessor: Option<PreviousRoom>,
},
}
}
/// A reference to an old room replaced during a room version upgrade.