events: Add support for formatted body on KeyVerificationRequestEventContent

This commit is contained in:
Kévin Commaille 2022-11-25 14:30:49 +01:00 committed by Kévin Commaille
parent 583ee2cdfa
commit 74161014be
2 changed files with 14 additions and 1 deletions

View File

@ -51,6 +51,7 @@ Improvements:
* `Ruleset::set_enabled` to change the enabled state of push rules
* `Ruleset::set_actions` to change the actions of push rules
* Add support for bundled reference relations (MSC3267 / Matrix 1.5)
* Add the `formatted` field on `KeyVerificationRequestEventContent` (Matrix 1.5)
# 0.10.5

View File

@ -1,5 +1,6 @@
use serde::{Deserialize, Serialize};
use super::FormattedBody;
use crate::{events::key::verification::VerificationMethod, OwnedDeviceId, OwnedUserId};
/// The payload for a key verification request message.
@ -9,8 +10,19 @@ use crate::{events::key::verification::VerificationMethod, OwnedDeviceId, OwnedU
pub struct KeyVerificationRequestEventContent {
/// A fallback message to alert users that their client does not support the key verification
/// framework.
///
/// Clients that do support the key verification framework should hide the body and instead
/// present the user with an interface to accept or reject the key verification.
pub body: String,
/// Formatted form of the `body`.
///
/// As with the `body`, clients that do support the key verification framework should hide the
/// formatted body and instead present the user with an interface to accept or reject the key
/// verification.
#[serde(flatten)]
pub formatted: Option<FormattedBody>,
/// The verification methods supported by the sender.
pub methods: Vec<VerificationMethod>,
@ -34,6 +46,6 @@ impl KeyVerificationRequestEventContent {
from_device: OwnedDeviceId,
to: OwnedUserId,
) -> Self {
Self { body, methods, from_device, to }
Self { body, formatted: None, methods, from_device, to }
}
}