room-messages: Add the ability to send encrypted room messages
This commit is contained in:
parent
b7be79c5b4
commit
df05e88793
@ -1,5 +1,9 @@
|
|||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
|
||||||
|
* Add a encrypted variant to the room `MessageEventContent` enum.
|
||||||
|
|
||||||
# 0.20.0
|
# 0.20.0
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
@ -7,7 +7,7 @@ use ruma_identifiers::{EventId, RoomId, UserId};
|
|||||||
use serde::{ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde_json::{from_value, Value};
|
use serde_json::{from_value, Value};
|
||||||
|
|
||||||
use super::{EncryptedFile, ImageInfo, ThumbnailInfo};
|
use super::{encrypted::EncryptedEventContent, EncryptedFile, ImageInfo, ThumbnailInfo};
|
||||||
use crate::{EventType, FromRaw};
|
use crate::{EventType, FromRaw};
|
||||||
|
|
||||||
pub mod feedback;
|
pub mod feedback;
|
||||||
@ -69,6 +69,9 @@ pub enum MessageEventContent {
|
|||||||
/// A video message.
|
/// A video message.
|
||||||
Video(VideoMessageEventContent),
|
Video(VideoMessageEventContent),
|
||||||
|
|
||||||
|
/// A encrypted message.
|
||||||
|
Encrypted(EncryptedEventContent),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
/// Additional variants may be added in the future and will not be considered breaking changes
|
||||||
/// to ruma-events.
|
/// to ruma-events.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
@ -106,6 +109,7 @@ impl FromRaw for MessageEventContent {
|
|||||||
ServerNotice(content) => MessageEventContent::ServerNotice(content),
|
ServerNotice(content) => MessageEventContent::ServerNotice(content),
|
||||||
Text(content) => MessageEventContent::Text(content),
|
Text(content) => MessageEventContent::Text(content),
|
||||||
Video(content) => MessageEventContent::Video(content),
|
Video(content) => MessageEventContent::Video(content),
|
||||||
|
Encrypted(content) => MessageEventContent::Encrypted(content),
|
||||||
__Nonexhaustive => {
|
__Nonexhaustive => {
|
||||||
unreachable!("It should be impossible to obtain a __Nonexhaustive variant.")
|
unreachable!("It should be impossible to obtain a __Nonexhaustive variant.")
|
||||||
}
|
}
|
||||||
@ -132,6 +136,7 @@ impl Serialize for MessageEventContent {
|
|||||||
MessageEventContent::ServerNotice(ref content) => content.serialize(serializer),
|
MessageEventContent::ServerNotice(ref content) => content.serialize(serializer),
|
||||||
MessageEventContent::Text(ref content) => content.serialize(serializer),
|
MessageEventContent::Text(ref content) => content.serialize(serializer),
|
||||||
MessageEventContent::Video(ref content) => content.serialize(serializer),
|
MessageEventContent::Video(ref content) => content.serialize(serializer),
|
||||||
|
MessageEventContent::Encrypted(ref content) => content.serialize(serializer),
|
||||||
MessageEventContent::__Nonexhaustive => Err(S::Error::custom(
|
MessageEventContent::__Nonexhaustive => Err(S::Error::custom(
|
||||||
"Attempted to deserialize __Nonexhaustive variant.",
|
"Attempted to deserialize __Nonexhaustive variant.",
|
||||||
)),
|
)),
|
||||||
@ -197,6 +202,9 @@ pub(crate) mod raw {
|
|||||||
/// A video message.
|
/// A video message.
|
||||||
Video(VideoMessageEventContent),
|
Video(VideoMessageEventContent),
|
||||||
|
|
||||||
|
/// A video message.
|
||||||
|
Encrypted(EncryptedEventContent),
|
||||||
|
|
||||||
/// Additional variants may be added in the future and will not be considered breaking changes
|
/// Additional variants may be added in the future and will not be considered breaking changes
|
||||||
/// to ruma-events.
|
/// to ruma-events.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user