From d5b38354d0b98e9f785e427c12126eaa4066b6c4 Mon Sep 17 00:00:00 2001 From: Jimmy Cuadra Date: Sat, 13 Jul 2019 04:04:13 -0700 Subject: [PATCH] Convert m.room.member to the new API. Remove dependency on ruma-signatures. --- Cargo.toml | 1 - src/room.rs | 2 +- src/room/member.rs | 13 +++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f869b985..39d92cc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ edition = "2018" [dependencies] ruma-identifiers = "0.13.0" ruma-events-macros = { path = "../ruma-events-macros" } -ruma-signatures = "0.4.2" serde_json = "1.0.39" [dependencies.js_int] diff --git a/src/room.rs b/src/room.rs index 825f72ba..5b4e35a4 100644 --- a/src/room.rs +++ b/src/room.rs @@ -16,7 +16,7 @@ pub mod encryption; pub mod guest_access; pub mod history_visibility; pub mod join_rules; -// pub mod member; +pub mod member; pub mod message; pub mod name; pub mod pinned_events; diff --git a/src/room/member.rs b/src/room/member.rs index c83f6575..5fc83b31 100644 --- a/src/room/member.rs +++ b/src/room/member.rs @@ -1,9 +1,10 @@ //! Types for the *m.room.member* event. +use std::collections::HashMap; + use js_int::UInt; use ruma_events_macros::ruma_event; use ruma_identifiers::UserId; -use ruma_signatures::Signatures; use serde::{Deserialize, Serialize}; ruma_event! { @@ -22,8 +23,8 @@ ruma_event! { /// present, this contains an array of `StrippedState` events. These events provide information /// on a subset of state events such as the room name. Note that ruma-events treats unsigned /// data on events as arbitrary JSON values, and the ruma-events types for this event don't - /// provide direct access to these `invite_room_state`. If you need this data, you must extract - /// and convert it from a `serde_json::Value` yourself. + /// provide direct access to `invite_room_state`. If you need this data, you must extract and + /// convert it from a `serde_json::Value` yourself. /// /// The user for which a membership applies is represented by the `state_key`. Under some /// conditions, the `sender` and `state_key` may not match - this may be interpreted as the @@ -101,7 +102,7 @@ impl_enum! { } /// Information about a third party invitation. -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct ThirdPartyInvite { /// A name which can be displayed to represent the user instead of their third party /// identifier. @@ -114,7 +115,7 @@ pub struct ThirdPartyInvite { /// A block of content which has been signed, which servers can use to verify a third party /// invitation. -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct SignedContent { /// The invited Matrix user ID. /// @@ -123,7 +124,7 @@ pub struct SignedContent { /// A single signature from the verifying server, in the format specified by the Signing Events /// section of the server-server API. - pub signatures: Signatures, + pub signatures: HashMap>, /// The token property of the containing third_party_invite object. pub token: String,