diff --git a/crates/ruma-common/src/events/emote.rs b/crates/ruma-common/src/events/emote.rs index 3df76efa..6c57263e 100644 --- a/crates/ruma-common/src/events/emote.rs +++ b/crates/ruma-common/src/events/emote.rs @@ -31,34 +31,32 @@ pub struct EmoteEventContent { #[serde(flatten)] pub message: MessageContent, - /// Information about related messages for [rich replies]. - /// - /// [rich replies]: https://spec.matrix.org/v1.2/client-server-api/#rich-replies + /// Information about related messages. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub relates_to: Option, } impl EmoteEventContent { - /// A convenience constructor to create a plain text message. + /// A convenience constructor to create a plain text emote. pub fn plain(body: impl Into) -> Self { Self { message: MessageContent::plain(body), relates_to: None } } - /// A convenience constructor to create an HTML message. + /// A convenience constructor to create an HTML emote. pub fn html(body: impl Into, html_body: impl Into) -> Self { Self { message: MessageContent::html(body, html_body), relates_to: None } } - /// A convenience constructor to create a Markdown message. + /// A convenience constructor to create a Markdown emote. /// - /// Returns an HTML message if some Markdown formatting was detected, otherwise returns a plain - /// text message. + /// Returns an HTML emote if some Markdown formatting was detected, otherwise returns a plain + /// text emote. #[cfg(feature = "markdown")] pub fn markdown(body: impl AsRef + Into) -> Self { Self { message: MessageContent::markdown(body), relates_to: None } } - /// Create a new `MessageEventContent` from the given `EmoteMessageEventContent` and optional + /// Create a new `EmoteEventContent` from the given `EmoteMessageEventContent` and optional /// relation. pub fn from_emote_room_message( content: EmoteMessageEventContent, diff --git a/crates/ruma-common/src/events/file.rs b/crates/ruma-common/src/events/file.rs index 5c0654ac..43ddc904 100644 --- a/crates/ruma-common/src/events/file.rs +++ b/crates/ruma-common/src/events/file.rs @@ -42,9 +42,7 @@ pub struct FileEventContent { #[serde(rename = "m.file")] pub file: FileContent, - /// Information about related messages for [rich replies]. - /// - /// [rich replies]: https://spec.matrix.org/v1.2/client-server-api/#rich-replies + /// Information about related messages. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub relates_to: Option, } @@ -130,7 +128,7 @@ pub struct FileContent { /// Information on the encrypted file. /// - /// Required if file is encrypted. + /// Required if the file is encrypted. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub encryption_info: Option>, } @@ -179,7 +177,7 @@ pub struct FileContentInfo { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, - /// The mimetype of the file, e.g. “application/msword”. + /// The mimetype of the file, e.g. "application/msword". #[serde(skip_serializing_if = "Option::is_none")] pub mimetype: Option, @@ -196,7 +194,7 @@ impl FileContentInfo { /// Create a new `FileContentInfo` with the given file info and filename. /// - /// Returns `None` if both parameters are `None` + /// Returns `None` if both parameters are `None`. pub fn from_room_message_content( info: Option>, filename: Option, diff --git a/crates/ruma-common/src/events/image.rs b/crates/ruma-common/src/events/image.rs index 7a1c2af8..4d41296b 100644 --- a/crates/ruma-common/src/events/image.rs +++ b/crates/ruma-common/src/events/image.rs @@ -58,9 +58,7 @@ pub struct ImageEventContent { )] pub caption: Option, - /// Information about related messages for [rich replies]. - /// - /// [rich replies]: https://spec.matrix.org/v1.2/client-server-api/#rich-replies + /// Information about related messages. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub relates_to: Option, } @@ -244,7 +242,7 @@ impl ThumbnailFileContent { Self { url, info, encryption_info: Some(Box::new(encryption_info)) } } - /// Create a `ThumbnailContent` with the given thumbnail source and info. + /// Create a `ThumbnailFileContent` with the given thumbnail source and info. /// /// Returns `None` if no thumbnail was found. fn from_room_message_content( diff --git a/crates/ruma-common/src/events/message.rs b/crates/ruma-common/src/events/message.rs index e3d20986..00e47efb 100644 --- a/crates/ruma-common/src/events/message.rs +++ b/crates/ruma-common/src/events/message.rs @@ -82,9 +82,7 @@ pub struct MessageEventContent { #[serde(flatten)] pub message: MessageContent, - /// Information about related messages for [rich replies]. - /// - /// [rich replies]: https://spec.matrix.org/v1.2/client-server-api/#rich-replies + /// Information about related messages. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub relates_to: Option, } diff --git a/crates/ruma-common/src/events/notice.rs b/crates/ruma-common/src/events/notice.rs index 16360874..f336a432 100644 --- a/crates/ruma-common/src/events/notice.rs +++ b/crates/ruma-common/src/events/notice.rs @@ -31,34 +31,32 @@ pub struct NoticeEventContent { #[serde(flatten)] pub message: MessageContent, - /// Information about related messages for [rich replies]. - /// - /// [rich replies]: https://spec.matrix.org/v1.2/client-server-api/#rich-replies + /// Information about related messages. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub relates_to: Option, } impl NoticeEventContent { - /// A convenience constructor to create a plain text message. + /// A convenience constructor to create a plain text notice. pub fn plain(body: impl Into) -> Self { Self { message: MessageContent::plain(body), relates_to: None } } - /// A convenience constructor to create an HTML message. + /// A convenience constructor to create an HTML notice. pub fn html(body: impl Into, html_body: impl Into) -> Self { Self { message: MessageContent::html(body, html_body), relates_to: None } } - /// A convenience constructor to create a Markdown message. + /// A convenience constructor to create a Markdown notice. /// - /// Returns an HTML message if some Markdown formatting was detected, otherwise returns a plain - /// text message. + /// Returns an HTML notice if some Markdown formatting was detected, otherwise returns a plain + /// text notice. #[cfg(feature = "markdown")] pub fn markdown(body: impl AsRef + Into) -> Self { Self { message: MessageContent::markdown(body), relates_to: None } } - /// Create a new `MessageEventContent` from the given `NoticeMessageEventContent` and optional + /// Create a new `NoticeEventContent` from the given `NoticeMessageEventContent` and optional /// relation. pub fn from_notice_room_message( content: NoticeMessageEventContent, diff --git a/crates/ruma-common/src/events/room/message.rs b/crates/ruma-common/src/events/room/message.rs index 2970a944..2ee19b02 100644 --- a/crates/ruma-common/src/events/room/message.rs +++ b/crates/ruma-common/src/events/room/message.rs @@ -588,7 +588,7 @@ pub struct AudioMessageEventContent { #[serde(flatten)] pub source: MediaSource, - /// Metadata for the audio clip referred to in `url`. + /// Metadata for the audio clip referred to in `source`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option>, @@ -622,7 +622,7 @@ pub struct AudioMessageEventContent { } impl AudioMessageEventContent { - /// Creates a new non-encrypted `RoomAudioMessageEventContent` with the given body, url and + /// Creates a new non-encrypted `AudioMessageEventContent` with the given body, url and /// optional extra info. pub fn plain(body: String, url: Box, info: Option>) -> Self { Self { @@ -643,7 +643,7 @@ impl AudioMessageEventContent { } } - /// Creates a new encrypted `RoomAudioMessageEventContent` with the given body and encrypted + /// Creates a new encrypted `AudioMessageEventContent` with the given body and encrypted /// file. pub fn encrypted(body: String, file: EncryptedFile) -> Self { Self { @@ -693,11 +693,11 @@ impl AudioMessageEventContent { #[cfg(feature = "unstable-msc3245")] pub fn from_extensible_voice_content( message: MessageContent, - ext_file: FileContent, + file: FileContent, audio: AudioContent, voice: VoiceContent, ) -> Self { - let mut content = Self::from_extensible_content(message, ext_file, audio); + let mut content = Self::from_extensible_content(message, file, audio); content.voice = Some(voice); content } @@ -849,7 +849,7 @@ pub struct FileMessageEventContent { #[serde(flatten)] pub source: MediaSource, - /// Metadata about the file referred to in `url`. + /// Metadata about the file referred to in `source`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option>, @@ -869,7 +869,7 @@ pub struct FileMessageEventContent { } impl FileMessageEventContent { - /// Creates a new non-encrypted `RoomFileMessageEventContent` with the given body, url and + /// Creates a new non-encrypted `FileMessageEventContent` with the given body, url and /// optional extra info. pub fn plain(body: String, url: Box, info: Option>) -> Self { Self { @@ -887,7 +887,7 @@ impl FileMessageEventContent { } } - /// Creates a new encrypted `RoomFileMessageEventContent` with the given body and encrypted + /// Creates a new encrypted `FileMessageEventContent` with the given body and encrypted /// file. pub fn encrypted(body: String, file: EncryptedFile) -> Self { Self { @@ -902,7 +902,7 @@ impl FileMessageEventContent { } } - /// Create a new `RoomFileMessageEventContent` with the given message and file info. + /// Create a new `FileMessageEventContent` with the given message and file info. #[cfg(feature = "unstable-msc3551")] pub fn from_extensible_content(message: MessageContent, file: FileContent) -> Self { let body = if let Some(body) = message.find_plain() { @@ -982,7 +982,7 @@ pub struct ImageMessageEventContent { #[serde(flatten)] pub source: MediaSource, - /// Metadata about the image referred to in `url`. + /// Metadata about the image referred to in `source`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option>, @@ -1026,7 +1026,7 @@ pub struct ImageMessageEventContent { } impl ImageMessageEventContent { - /// Creates a new non-encrypted `RoomImageMessageEventContent` with the given body, url and + /// Creates a new non-encrypted `ImageMessageEventContent` with the given body, url and /// optional extra info. pub fn plain(body: String, url: Box, info: Option>) -> Self { Self { @@ -1057,7 +1057,7 @@ impl ImageMessageEventContent { } } - /// Creates a new encrypted `RoomImageMessageEventContent` with the given body and encrypted + /// Creates a new encrypted `ImageMessageEventContent` with the given body and encrypted /// file. pub fn encrypted(body: String, file: EncryptedFile) -> Self { Self { @@ -1161,7 +1161,7 @@ pub struct LocationMessageEventContent { } impl LocationMessageEventContent { - /// Creates a new `RoomLocationMessageEventContent` with the given body and geo URI. + /// Creates a new `LocationMessageEventContent` with the given body and geo URI. pub fn new(body: String, geo_uri: String) -> Self { Self { #[cfg(feature = "unstable-msc3488")] @@ -1210,7 +1210,7 @@ impl LocationMessageEventContent { #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct LocationInfo { - /// The URL to a thumbnail of the location. + /// The source of a thumbnail of the location. #[serde( flatten, with = "super::thumbnail_source_serde", @@ -1328,7 +1328,7 @@ pub struct ServerNoticeMessageEventContent { } impl ServerNoticeMessageEventContent { - /// Creates a new `RoomServerNoticeMessageEventContent` with the given body and notice type. + /// Creates a new `ServerNoticeMessageEventContent` with the given body and notice type. pub fn new(body: String, server_notice_type: ServerNoticeType) -> Self { Self { body, server_notice_type, admin_contact: None, limit_type: None } } @@ -1422,9 +1422,9 @@ impl FormattedBody { Self { format: MessageFormat::Html, body: body.into() } } - /// Creates a new HTML-formatted message body by parsing the markdown in `body`. + /// Creates a new HTML-formatted message body by parsing the Markdown in `body`. /// - /// Returns `None` if no markdown formatting was found. + /// Returns `None` if no Markdown formatting was found. #[cfg(feature = "markdown")] pub fn markdown(body: impl AsRef) -> Option { let body = body.as_ref(); @@ -1473,7 +1473,7 @@ impl TextMessageEventContent { } } - /// A convenience constructor to create an html message. + /// A convenience constructor to create an HTML message. pub fn html(body: impl Into, html_body: impl Into) -> Self { let body = body.into(); let html_body = html_body.into(); @@ -1485,9 +1485,9 @@ impl TextMessageEventContent { } } - /// A convenience constructor to create a markdown message. + /// A convenience constructor to create a Markdown message. /// - /// Returns an html message if some markdown formatting was detected, otherwise returns a plain + /// Returns an HTML message if some Markdown formatting was detected, otherwise returns a plain /// text message. #[cfg(feature = "markdown")] pub fn markdown(body: impl AsRef + Into) -> Self { @@ -1531,7 +1531,7 @@ pub struct VideoMessageEventContent { #[serde(flatten)] pub source: MediaSource, - /// Metadata about the video clip referred to in `url`. + /// Metadata about the video clip referred to in `source`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option>, @@ -1575,7 +1575,7 @@ pub struct VideoMessageEventContent { } impl VideoMessageEventContent { - /// Creates a new non-encrypted `RoomVideoMessageEventContent` with the given body, url and + /// Creates a new non-encrypted `VideoMessageEventContent` with the given body, url and /// optional extra info. pub fn plain(body: String, url: Box, info: Option>) -> Self { Self { @@ -1606,7 +1606,7 @@ impl VideoMessageEventContent { } } - /// Creates a new encrypted `RoomVideoMessageEventContent` with the given body and encrypted + /// Creates a new encrypted `VideoMessageEventContent` with the given body and encrypted /// file. pub fn encrypted(body: String, file: EncryptedFile) -> Self { Self { @@ -1780,7 +1780,7 @@ pub struct KeyVerificationRequestEventContent { } impl KeyVerificationRequestEventContent { - /// Creates a new `RoomKeyVerificationRequestEventContent` with the given body, method, device + /// Creates a new `KeyVerificationRequestEventContent` with the given body, method, device /// and user ID. pub fn new( body: String, diff --git a/crates/ruma-common/src/events/room/message/content_serde.rs b/crates/ruma-common/src/events/room/message/content_serde.rs index 64720368..d4347c82 100644 --- a/crates/ruma-common/src/events/room/message/content_serde.rs +++ b/crates/ruma-common/src/events/room/message/content_serde.rs @@ -167,7 +167,7 @@ pub struct FileMessageEventContentDeHelper { #[serde(flatten)] pub source: MediaSource, - /// Metadata about the file referred to in `url`. + /// Metadata about the file referred to in `source`. pub info: Option>, /// Extensible-event text representation of the message. diff --git a/crates/ruma-common/src/events/voice.rs b/crates/ruma-common/src/events/voice.rs index 7410eefa..555f132e 100644 --- a/crates/ruma-common/src/events/voice.rs +++ b/crates/ruma-common/src/events/voice.rs @@ -41,7 +41,7 @@ pub struct VoiceEventContent { #[serde(rename = "m.audio")] pub audio: AudioContent, - /// The audio content of the message. + /// The voice content of the message. #[serde(rename = "m.voice")] pub voice: VoiceContent, @@ -99,6 +99,9 @@ impl VoiceEventContent { } /// Voice content. +/// +/// This is currently empty and used as a flag to mark an audio event that should be displayed as a +/// voice message. #[derive(Clone, Debug, Default, Serialize, Deserialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct VoiceContent {}