diff --git a/crates/ruma-federation-api/src/membership/create_invite/v1.rs b/crates/ruma-federation-api/src/membership/create_invite/v1.rs index 1fdd9185..2b6e09b8 100644 --- a/crates/ruma-federation-api/src/membership/create_invite/v1.rs +++ b/crates/ruma-federation-api/src/membership/create_invite/v1.rs @@ -4,7 +4,7 @@ use ruma_common::{ api::ruma_api, - events::{room::member::RoomMemberEventContent, AnyStrippedStateEvent, EventType}, + events::{room::member::RoomMemberEventContent, AnyStrippedStateEvent, StateEventType}, serde::Raw, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, UserId, }; @@ -42,7 +42,7 @@ ruma_api! { /// The value `m.room.member`. #[serde(rename = "type")] - pub kind: EventType, + pub kind: StateEventType, /// The user ID of the invited member. pub state_key: &'a UserId, @@ -124,7 +124,7 @@ impl<'a> From> for Request<'a> { sender: init.sender, origin: init.origin, origin_server_ts: init.origin_server_ts, - kind: EventType::RoomMember, + kind: StateEventType::RoomMember, state_key: init.state_key, content: init.content, unsigned: init.unsigned, diff --git a/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs b/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs index 57abad94..b128c405 100644 --- a/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs +++ b/crates/ruma-federation-api/src/membership/create_leave_event/v1.rs @@ -5,7 +5,7 @@ use js_int::UInt; use ruma_common::{ api::ruma_api, - events::{room::member::RoomMemberEventContent, EventType}, + events::{room::member::RoomMemberEventContent, StateEventType}, serde::Raw, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, UserId, }; @@ -46,7 +46,7 @@ ruma_api! { /// The value `m.room.member`. #[ruma_api(query)] #[serde(rename = "type")] - pub event_type: EventType, + pub event_type: StateEventType, /// The user ID of the leaving member. #[ruma_api(query)] @@ -95,7 +95,7 @@ pub struct RequestInit<'a> { pub origin_server_ts: MilliSecondsSinceUnixEpoch, /// The value `m.room.member`. - pub event_type: EventType, + pub event_type: StateEventType, /// The user ID of the leaving member. pub state_key: &'a str, diff --git a/crates/ruma-federation-api/src/thirdparty/exchange_invite.rs b/crates/ruma-federation-api/src/thirdparty/exchange_invite.rs index db9740cf..7c9cd3a7 100644 --- a/crates/ruma-federation-api/src/thirdparty/exchange_invite.rs +++ b/crates/ruma-federation-api/src/thirdparty/exchange_invite.rs @@ -13,7 +13,7 @@ pub mod v1 { use ruma_common::{ api::ruma_api, - events::{room::member::ThirdPartyInvite, EventType}, + events::{room::member::ThirdPartyInvite, StateEventType}, RoomId, UserId, }; @@ -35,9 +35,9 @@ pub mod v1 { /// The event type. /// - /// Must be `EventType::RoomMember`. + /// Must be `StateEventType::RoomMember`. #[serde(rename = "type")] - pub kind: EventType, + pub kind: StateEventType, /// The user ID of the user who sent the original invite event. pub sender: &'a UserId, @@ -61,7 +61,7 @@ pub mod v1 { state_key: &'a UserId, content: &'a ThirdPartyInvite, ) -> Self { - Self { room_id, kind: EventType::RoomMember, sender, state_key, content } + Self { room_id, kind: StateEventType::RoomMember, sender, state_key, content } } } diff --git a/crates/ruma-federation-api/src/transactions/edu.rs b/crates/ruma-federation-api/src/transactions/edu.rs index 46a67989..f8f0fbd8 100644 --- a/crates/ruma-federation-api/src/transactions/edu.rs +++ b/crates/ruma-federation-api/src/transactions/edu.rs @@ -5,7 +5,7 @@ use std::collections::BTreeMap; use js_int::UInt; use ruma_common::{ encryption::{CrossSigningKey, DeviceKeys}, - events::{receipt::Receipt, AnyToDeviceEventContent, EventType}, + events::{receipt::Receipt, AnyToDeviceEventContent, ToDeviceEventType}, presence::PresenceState, serde::{from_raw_json_value, Raw}, to_device::DeviceIdOrAllDevices, @@ -264,7 +264,7 @@ pub struct DirectDeviceContent { /// Event type for the message. #[serde(rename = "type")] - pub ev_type: EventType, + pub ev_type: ToDeviceEventType, /// Unique utf8 string ID for the message, used for idempotency. pub message_id: Box, @@ -278,7 +278,11 @@ pub struct DirectDeviceContent { impl DirectDeviceContent { /// Creates a new `DirectDeviceContent` with the given `sender, `ev_type` and `message_id`. - pub fn new(sender: Box, ev_type: EventType, message_id: Box) -> Self { + pub fn new( + sender: Box, + ev_type: ToDeviceEventType, + message_id: Box, + ) -> Self { Self { sender, ev_type, message_id, messages: DirectDeviceMessages::new() } } } @@ -489,7 +493,7 @@ mod test { Edu::DirectToDevice(DirectDeviceContent { sender, ev_type, message_id, messages }) if sender == "@john:example.com" - && *ev_type == EventType::RoomKeyRequest + && *ev_type == ToDeviceEventType::RoomKeyRequest && message_id == "hiezohf6Hoo7kaev" && messages.get(user_id!("@alice:example.org")).is_some() );