events: Split EncryptedEventContent in two
This commit is contained in:
parent
31bed8be9a
commit
b2b8265ded
@ -9,6 +9,9 @@ Breaking changes:
|
||||
validation
|
||||
* Remove unused `FromStrError`
|
||||
* Remove deprecated method `room::name::NameEventContent::name`
|
||||
* Make `encrypted::EncryptedToDeviceEventContent` its own type instead of a type
|
||||
alias for `EncryptedEventContent`
|
||||
* It doesn't have the `relates_to` field `EncryptedEventContent` has
|
||||
* Upgrade dependencies
|
||||
|
||||
# 0.24.0
|
||||
|
@ -26,7 +26,7 @@ pub type EncryptedEvent = MessageEvent<EncryptedEventContent>;
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encrypted", kind = Message, kind = ToDevice)]
|
||||
pub struct EncryptedEventContent {
|
||||
/// Encrypted event content
|
||||
/// Algorithm-specific fields.
|
||||
#[serde(flatten)]
|
||||
pub scheme: EncryptedEventScheme,
|
||||
|
||||
@ -37,9 +37,6 @@ pub struct EncryptedEventContent {
|
||||
pub relates_to: Option<Relation>,
|
||||
}
|
||||
|
||||
/// The to-device version of the payload for the `EncryptedEvent`.
|
||||
pub type EncryptedToDeviceEventContent = EncryptedEventContent;
|
||||
|
||||
impl EncryptedEventContent {
|
||||
/// Creates a new `EncryptedEventContent` with the given scheme and relation.
|
||||
pub fn new(scheme: EncryptedEventScheme, relates_to: Option<Relation>) -> Self {
|
||||
@ -53,7 +50,17 @@ impl From<EncryptedEventScheme> for EncryptedEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// The encryption scheme for `EncryptedEventContent`
|
||||
/// The to-device content payload for `m.encrypted` events.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[ruma_event(type = "m.room.encrypted", kind = ToDevice)]
|
||||
pub struct EncryptedToDeviceEventContent {
|
||||
/// Algorithm-specific fields.
|
||||
#[serde(flatten)]
|
||||
pub scheme: EncryptedEventScheme,
|
||||
}
|
||||
|
||||
/// The encryption scheme for `EncryptedEventContent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[serde(tag = "algorithm")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user