Change EncryptedEventContent from StateEventContent to MessageEventContent

… and add it to AnyMessageEventContent
This commit is contained in:
Ragotzy.devin 2020-06-11 17:48:57 -04:00 committed by GitHub
parent 9f93d20a34
commit be0838e7d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -41,6 +41,7 @@ event_content_enum! {
"m.call.invite", "m.call.invite",
"m.call.hangup", "m.call.hangup",
"m.call.candidates", "m.call.candidates",
"m.room.encrypted",
"m.room.message", "m.room.message",
"m.room.message.feedback", "m.room.message.feedback",
"m.sticker", "m.sticker",

View File

@ -3,17 +3,17 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use js_int::UInt; use js_int::UInt;
use ruma_events_macros::StateEventContent; use ruma_events_macros::MessageEventContent;
use ruma_identifiers::DeviceId; use ruma_identifiers::DeviceId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::StateEvent; use crate::MessageEvent;
/// An event that defines how messages sent in this room should be encrypted. /// An event that defines how messages sent in this room should be encrypted.
pub type EncryptedEvent = StateEvent<EncryptedEventContent>; pub type EncryptedEvent = MessageEvent<EncryptedEventContent>;
/// The payload for `EncryptedEvent`. /// The payload for `EncryptedEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, StateEventContent)] #[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
#[non_exhaustive] #[non_exhaustive]
#[ruma_event(type = "m.room.encrypted")] #[ruma_event(type = "m.room.encrypted")]
#[serde(tag = "algorithm")] #[serde(tag = "algorithm")]