From 148d876acbcf4cffc3c7b5c1c8f58a4a792408e9 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 13 Aug 2020 21:57:56 +0200 Subject: [PATCH] Use ServerNameBox in ruma-events, ruma-*-api --- ruma-client-api/src/r0/account/request_openid_token.rs | 4 ++-- .../src/r0/membership/join_room_by_id_or_alias.rs | 4 ++-- ruma-client-api/src/r0/session/login.rs | 4 ++-- ruma-events/src/pdu.rs | 10 +++++----- ruma-events/src/room/member.rs | 4 ++-- ruma-federation-api/src/backfill/get_backfill/v1.rs | 6 +++--- ruma-federation-api/src/discovery.rs | 6 +++--- .../src/discovery/get_remote_server_keys_batch/v2.rs | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ruma-client-api/src/r0/account/request_openid_token.rs b/ruma-client-api/src/r0/account/request_openid_token.rs index 74b5c622..b9b71ee4 100644 --- a/ruma-client-api/src/r0/account/request_openid_token.rs +++ b/ruma-client-api/src/r0/account/request_openid_token.rs @@ -3,7 +3,7 @@ use std::time::Duration; use ruma_api::ruma_api; -use ruma_identifiers::{ServerName, UserId}; +use ruma_identifiers::{ServerNameBox, UserId}; use serde::{Deserialize, Serialize}; ruma_api! { @@ -30,7 +30,7 @@ ruma_api! { pub token_type: TokenType, /// Homeserver domain for verification of user's identity. - pub matrix_server_name: Box, + pub matrix_server_name: ServerNameBox, /// Seconds until token expiration. #[serde(with = "ruma_serde::duration::secs")] diff --git a/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs b/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs index 013dc043..bfb69791 100644 --- a/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs +++ b/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs @@ -1,7 +1,7 @@ //! [POST /_matrix/client/r0/join/{roomIdOrAlias}](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-join-roomidoralias) use ruma_api::ruma_api; -use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerName}; +use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerNameBox}; use super::{IncomingThirdPartySigned, ThirdPartySigned}; @@ -24,7 +24,7 @@ ruma_api! { /// must be participating in the room. #[ruma_api(query)] #[serde(default)] - pub server_name: &'a [Box], + pub server_name: &'a [ServerNameBox], /// The signature of a `m.third_party_invite` token to prove that this user owns a third /// party identity which has been invited to the room. diff --git a/ruma-client-api/src/r0/session/login.rs b/ruma-client-api/src/r0/session/login.rs index c33839b6..0513cf8e 100644 --- a/ruma-client-api/src/r0/session/login.rs +++ b/ruma-client-api/src/r0/session/login.rs @@ -2,7 +2,7 @@ use ruma_api::{ruma_api, Outgoing}; use ruma_common::thirdparty::Medium; -use ruma_identifiers::{DeviceId, DeviceIdBox, ServerName, UserId}; +use ruma_identifiers::{DeviceId, DeviceIdBox, ServerNameBox, UserId}; use serde::{Deserialize, Serialize}; ruma_api! { @@ -46,7 +46,7 @@ ruma_api! { /// Deprecated: Clients should instead use the `user_id.server_name()` /// method if they require it. #[serde(skip_serializing_if = "Option::is_none")] - pub home_server: Option>, + pub home_server: Option, /// ID of the logged-in device. /// diff --git a/ruma-events/src/pdu.rs b/ruma-events/src/pdu.rs index af05b085..746aa1fa 100644 --- a/ruma-events/src/pdu.rs +++ b/ruma-events/src/pdu.rs @@ -12,7 +12,7 @@ use std::{collections::BTreeMap, time::SystemTime}; use js_int::UInt; use ruma_events::EventType; -use ruma_identifiers::{EventId, RoomId, ServerKeyId, ServerName, UserId}; +use ruma_identifiers::{EventId, RoomId, ServerKeyId, ServerNameBox, UserId}; use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; @@ -84,7 +84,7 @@ pub struct RoomV1Pdu { pub hashes: EventHash, /// Signatures for the PDU. - pub signatures: BTreeMap, BTreeMap>, + pub signatures: BTreeMap>, } /// A 'persistent data unit' (event) for room versions 3 and beyond. @@ -140,7 +140,7 @@ pub struct RoomV3Pdu { pub hashes: EventHash, /// Signatures for the PDU. - pub signatures: BTreeMap, BTreeMap>, + pub signatures: BTreeMap>, } /// PDU type without event and room IDs. @@ -216,7 +216,7 @@ pub struct RoomV1PduStub { pub hashes: EventHash, /// Signatures for the PDU. - pub signatures: BTreeMap, BTreeMap>, + pub signatures: BTreeMap>, } impl RoomV1PduStub { @@ -292,7 +292,7 @@ pub struct RoomV3PduStub { pub hashes: EventHash, /// Signatures for the PDU. - pub signatures: BTreeMap, BTreeMap>, + pub signatures: BTreeMap>, } impl RoomV3PduStub { diff --git a/ruma-events/src/room/member.rs b/ruma-events/src/room/member.rs index d5fd8bae..be98f315 100644 --- a/ruma-events/src/room/member.rs +++ b/ruma-events/src/room/member.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use ruma_events_macros::StateEventContent; -use ruma_identifiers::{ServerKeyId, ServerName, UserId}; +use ruma_identifiers::{ServerKeyId, ServerNameBox, UserId}; use serde::{Deserialize, Serialize}; use strum::{Display, EnumString}; @@ -108,7 +108,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: BTreeMap, BTreeMap>, + pub signatures: BTreeMap>, /// The token property of the containing third_party_invite object. pub token: String, diff --git a/ruma-federation-api/src/backfill/get_backfill/v1.rs b/ruma-federation-api/src/backfill/get_backfill/v1.rs index abfe1ff6..ccd0502f 100644 --- a/ruma-federation-api/src/backfill/get_backfill/v1.rs +++ b/ruma-federation-api/src/backfill/get_backfill/v1.rs @@ -5,7 +5,7 @@ use std::time::SystemTime; use js_int::UInt; use ruma_api::ruma_api; use ruma_events::pdu::Pdu; -use ruma_identifiers::{EventId, RoomId, ServerName}; +use ruma_identifiers::{EventId, RoomId, ServerNameBox}; ruma_api! { metadata: { @@ -33,7 +33,7 @@ ruma_api! { response: { /// The `server_name` of the homeserver sending this transaction. - pub origin: Box, + pub origin: ServerNameBox, /// POSIX timestamp in milliseconds on originating homeserver when this transaction started. #[serde(with = "ruma_serde::time::ms_since_unix_epoch")] @@ -59,7 +59,7 @@ impl Response { /// * the `server_name` of the homeserver. /// * the timestamp in milliseconds of when this transaction started. /// * the list of persistent updates to rooms. - pub fn new(origin: Box, origin_server_ts: SystemTime, pdus: Vec) -> Self { + pub fn new(origin: ServerNameBox, origin_server_ts: SystemTime, pdus: Vec) -> Self { Self { origin, origin_server_ts, pdus } } } diff --git a/ruma-federation-api/src/discovery.rs b/ruma-federation-api/src/discovery.rs index 1ec5385e..e010b833 100644 --- a/ruma-federation-api/src/discovery.rs +++ b/ruma-federation-api/src/discovery.rs @@ -2,7 +2,7 @@ use std::{collections::BTreeMap, time::SystemTime}; -use ruma_identifiers::{ServerKeyId, ServerName}; +use ruma_identifiers::{ServerKeyId, ServerNameBox}; use serde::{Deserialize, Serialize}; pub mod discover_homeserver; @@ -34,14 +34,14 @@ pub struct OldVerifyKey { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ServerKey { /// DNS name of the homeserver. - pub server_name: Box, + pub server_name: ServerNameBox, /// Public keys of the homeserver for verifying digital signatures. pub verify_keys: BTreeMap, /// Public keys that the homeserver used to use and when it stopped using them. pub old_verify_keys: BTreeMap, /// Digital signatures of this object signed using the verify_keys. Map of /// server name to keys by key ID - pub signatures: BTreeMap, BTreeMap>, + pub signatures: BTreeMap>, /// Timestamp when the keys should be refreshed. This field MUST be ignored in room /// versions 1, 2, 3, and 4. #[serde(with = "ruma_serde::time::ms_since_unix_epoch")] diff --git a/ruma-federation-api/src/discovery/get_remote_server_keys_batch/v2.rs b/ruma-federation-api/src/discovery/get_remote_server_keys_batch/v2.rs index c4077b72..194cc249 100644 --- a/ruma-federation-api/src/discovery/get_remote_server_keys_batch/v2.rs +++ b/ruma-federation-api/src/discovery/get_remote_server_keys_batch/v2.rs @@ -4,7 +4,7 @@ use std::{collections::BTreeMap, time::SystemTime}; use crate::discovery::ServerKey; use ruma_api::ruma_api; -use ruma_identifiers::{ServerKeyId, ServerName}; +use ruma_identifiers::{ServerKeyId, ServerNameBox}; use serde::{Deserialize, Serialize}; ruma_api! { @@ -28,7 +28,7 @@ ruma_api! { /// The notary server may return multiple keys regardless of the Key IDs /// given. #[ruma_api(body)] - pub server_keys: BTreeMap, BTreeMap>, + pub server_keys: BTreeMap>, /// A millisecond POSIX timestamp in milliseconds indicating when the /// returned certificates will need to be valid until to be useful to