events: Use stable field prefix for extensible events

Only transitional room messages will be sent while unstable
This commit is contained in:
Kévin Commaille 2022-03-25 10:54:40 +01:00 committed by Kévin Commaille
parent 26556259c8
commit 4acfc8d591
12 changed files with 80 additions and 100 deletions

View File

@ -25,11 +25,11 @@ pub struct AudioEventContent {
pub message: MessageContent, pub message: MessageContent,
/// The file content of the message. /// The file content of the message.
#[serde(rename = "org.matrix.msc1767.file")] #[serde(rename = "m.file")]
pub file: FileContent, pub file: FileContent,
/// The audio content of the message. /// The audio content of the message.
#[serde(rename = "org.matrix.msc1767.audio")] #[serde(rename = "m.audio")]
pub audio: AudioContent, pub audio: AudioContent,
/// Information about related messages. /// Information about related messages.

View File

@ -142,7 +142,7 @@ pub struct FileEventContent {
pub message: MessageContent, pub message: MessageContent,
/// The file content of the message. /// The file content of the message.
#[serde(rename = "org.matrix.msc1767.file")] #[serde(rename = "m.file")]
pub file: FileContent, pub file: FileContent,
/// Information about related messages for [rich replies]. /// Information about related messages for [rich replies].

View File

@ -23,27 +23,19 @@ pub struct ImageEventContent {
pub message: MessageContent, pub message: MessageContent,
/// The file content of the message. /// The file content of the message.
#[serde(rename = "org.matrix.msc1767.file")] #[serde(rename = "m.file")]
pub file: FileContent, pub file: FileContent,
/// The image content of the message. /// The image content of the message.
#[serde(rename = "org.matrix.msc1767.image")] #[serde(rename = "m.image")]
pub image: Box<ImageContent>, pub image: Box<ImageContent>,
/// The thumbnails of the message. /// The thumbnails of the message.
#[serde( #[serde(rename = "m.thumbnail", default, skip_serializing_if = "Thumbnails::is_empty")]
rename = "org.matrix.msc1767.thumbnail",
default,
skip_serializing_if = "Thumbnails::is_empty"
)]
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
/// The thumbnails of the message. /// The captions of the message.
#[serde( #[serde(rename = "m.caption", default, skip_serializing_if = "Captions::is_empty")]
rename = "org.matrix.msc1767.caption",
default,
skip_serializing_if = "Captions::is_empty"
)]
pub caption: Captions, pub caption: Captions,
/// Information about related messages for [rich replies]. /// Information about related messages for [rich replies].

View File

@ -23,19 +23,15 @@ pub struct LocationEventContent {
pub message: MessageContent, pub message: MessageContent,
/// The location info of the message. /// The location info of the message.
#[serde(rename = "org.matrix.msc3488.location")] #[serde(rename = "m.location")]
pub location: LocationContent, pub location: LocationContent,
/// The asset this message refers to. /// The asset this message refers to.
#[serde( #[serde(default, rename = "m.asset", skip_serializing_if = "ruma_common::serde::is_default")]
default,
rename = "org.matrix.msc3488.asset",
skip_serializing_if = "ruma_common::serde::is_default"
)]
pub asset: AssetContent, pub asset: AssetContent,
/// The timestamp this message refers to. /// The timestamp this message refers to.
#[serde(rename = "org.matrix.msc3488.ts", skip_serializing_if = "Option::is_none")] #[serde(rename = "m.ts", skip_serializing_if = "Option::is_none")]
pub ts: Option<MilliSecondsSinceUnixEpoch>, pub ts: Option<MilliSecondsSinceUnixEpoch>,
/// Information about related messages. /// Information about related messages.

View File

@ -25,27 +25,19 @@ pub struct VideoEventContent {
pub message: MessageContent, pub message: MessageContent,
/// The file content of the message. /// The file content of the message.
#[serde(rename = "org.matrix.msc1767.file")] #[serde(rename = "m.file")]
pub file: FileContent, pub file: FileContent,
/// The video content of the message. /// The video content of the message.
#[serde(rename = "org.matrix.msc1767.video")] #[serde(rename = "m.video")]
pub video: Box<VideoContent>, pub video: Box<VideoContent>,
/// The thumbnails of the message. /// The thumbnails of the message.
#[serde( #[serde(rename = "m.thumbnail", default, skip_serializing_if = "Thumbnails::is_empty")]
rename = "org.matrix.msc1767.thumbnail",
default,
skip_serializing_if = "Thumbnails::is_empty"
)]
pub thumbnail: Thumbnails, pub thumbnail: Thumbnails,
/// The captions of the message. /// The captions of the message.
#[serde( #[serde(rename = "m.caption", default, skip_serializing_if = "Captions::is_empty")]
rename = "org.matrix.msc1767.caption",
default,
skip_serializing_if = "Captions::is_empty"
)]
pub caption: Captions, pub caption: Captions,
/// Information about related messages. /// Information about related messages.

View File

@ -19,15 +19,15 @@ pub struct VoiceEventContent {
pub message: MessageContent, pub message: MessageContent,
/// The file content of the message. /// The file content of the message.
#[serde(rename = "org.matrix.msc1767.file")] #[serde(rename = "m.file")]
pub file: FileContent, pub file: FileContent,
/// The audio content of the message. /// The audio content of the message.
#[serde(rename = "org.matrix.msc1767.audio")] #[serde(rename = "m.audio")]
pub audio: AudioContent, pub audio: AudioContent,
/// The audio content of the message. /// The audio content of the message.
#[serde(rename = "org.matrix.msc3245.voice")] #[serde(rename = "m.voice")]
pub voice: VoiceContent, pub voice: VoiceContent,
/// Information about related messages. /// Information about related messages.

View File

@ -73,10 +73,10 @@ fn plain_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_sound.ogg", "org.matrix.msc1767.text": "Upload: my_sound.ogg",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
}, },
"org.matrix.msc1767.audio": {} "m.audio": {}
}) })
); );
} }
@ -113,7 +113,7 @@ fn encrypted_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_sound.ogg", "org.matrix.msc1767.text": "Upload: my_sound.ogg",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -128,7 +128,7 @@ fn encrypted_content_serialization() {
}, },
"v": "v2" "v": "v2"
}, },
"org.matrix.msc1767.audio": {} "m.audio": {}
}) })
); );
} }
@ -181,13 +181,13 @@ fn event_serialization() {
{ "body": "Upload: <strong>my_mix.mp3</strong>", "mimetype": "text/html"}, { "body": "Upload: <strong>my_mix.mp3</strong>", "mimetype": "text/html"},
{ "body": "Upload: my_mix.mp3", "mimetype": "text/plain"}, { "body": "Upload: my_mix.mp3", "mimetype": "text/plain"},
], ],
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_mix.mp3", "name": "my_mix.mp3",
"mimetype": "audio/mp3", "mimetype": "audio/mp3",
"size": 897_774, "size": 897_774,
}, },
"org.matrix.msc1767.audio": { "m.audio": {
"duration": 123_000, "duration": 123_000,
}, },
"m.relates_to": { "m.relates_to": {
@ -209,10 +209,10 @@ fn event_serialization() {
fn plain_content_deserialization() { fn plain_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_new_song.webm", "org.matrix.msc1767.text": "Upload: my_new_song.webm",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
}, },
"org.matrix.msc1767.audio": { "m.audio": {
"waveform": [ "waveform": [
13, 13,
34, 34,
@ -290,7 +290,7 @@ fn plain_content_deserialization() {
fn encrypted_content_deserialization() { fn encrypted_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_file.txt", "org.matrix.msc1767.text": "Upload: my_file.txt",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -305,7 +305,7 @@ fn encrypted_content_deserialization() {
}, },
"v": "v2" "v": "v2"
}, },
"org.matrix.msc1767.audio": {}, "m.audio": {},
}); });
assert_matches!( assert_matches!(
@ -329,13 +329,13 @@ fn message_event_deserialization() {
let json_data = json!({ let json_data = json!({
"content": { "content": {
"org.matrix.msc1767.text": "Upload: airplane_sound.opus", "org.matrix.msc1767.text": "Upload: airplane_sound.opus",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "airplane_sound.opus", "name": "airplane_sound.opus",
"mimetype": "audio/opus", "mimetype": "audio/opus",
"size": 123_774, "size": 123_774,
}, },
"org.matrix.msc1767.audio": { "m.audio": {
"duration": 5_300, "duration": 5_300,
} }
}, },

View File

@ -32,7 +32,7 @@ fn plain_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_file.txt", "org.matrix.msc1767.text": "Upload: my_file.txt",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
} }
}) })
@ -69,7 +69,7 @@ fn encrypted_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_file.txt", "org.matrix.msc1767.text": "Upload: my_file.txt",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -128,7 +128,7 @@ fn file_event_serialization() {
{ "body": "Upload: <strong>my_file.txt</strong>", "mimetype": "text/html"}, { "body": "Upload: <strong>my_file.txt</strong>", "mimetype": "text/html"},
{ "body": "Upload: my_file.txt", "mimetype": "text/plain"}, { "body": "Upload: my_file.txt", "mimetype": "text/plain"},
], ],
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_file.txt", "name": "my_file.txt",
"mimetype": "text/plain", "mimetype": "text/plain",
@ -153,7 +153,7 @@ fn file_event_serialization() {
fn plain_content_deserialization() { fn plain_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_file.txt", "org.matrix.msc1767.text": "Upload: my_file.txt",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
} }
}); });
@ -172,7 +172,7 @@ fn plain_content_deserialization() {
fn encrypted_content_deserialization() { fn encrypted_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_file.txt", "org.matrix.msc1767.text": "Upload: my_file.txt",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -208,7 +208,7 @@ fn message_event_deserialization() {
{ "body": "Upload: <strong>my_file.txt</strong>", "mimetype": "text/html"}, { "body": "Upload: <strong>my_file.txt</strong>", "mimetype": "text/html"},
{ "body": "Upload: my_file.txt", "mimetype": "text/plain"}, { "body": "Upload: my_file.txt", "mimetype": "text/plain"},
], ],
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_file.txt", "name": "my_file.txt",
"mimetype": "text/plain", "mimetype": "text/plain",

View File

@ -35,10 +35,10 @@ fn plain_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_image.jpg", "org.matrix.msc1767.text": "Upload: my_image.jpg",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
}, },
"org.matrix.msc1767.image": {} "m.image": {}
}) })
); );
} }
@ -75,7 +75,7 @@ fn encrypted_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_image.jpg", "org.matrix.msc1767.text": "Upload: my_image.jpg",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -90,7 +90,7 @@ fn encrypted_content_serialization() {
}, },
"v": "v2" "v": "v2"
}, },
"org.matrix.msc1767.image": {} "m.image": {}
}) })
); );
} }
@ -149,24 +149,24 @@ fn image_event_serialization() {
{ "body": "Upload: <strong>my_house.jpg</strong>", "mimetype": "text/html"}, { "body": "Upload: <strong>my_house.jpg</strong>", "mimetype": "text/html"},
{ "body": "Upload: my_house.jpg", "mimetype": "text/plain"}, { "body": "Upload: my_house.jpg", "mimetype": "text/plain"},
], ],
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_house.jpg", "name": "my_house.jpg",
"mimetype": "image/jpeg", "mimetype": "image/jpeg",
"size": 897_774, "size": 897_774,
}, },
"org.matrix.msc1767.image": { "m.image": {
"width": 1920, "width": 1920,
"height": 1080, "height": 1080,
}, },
"org.matrix.msc1767.thumbnail": [ "m.thumbnail": [
{ {
"url": "mxc://notareal.hs/thumbnail", "url": "mxc://notareal.hs/thumbnail",
"mimetype": "image/jpeg", "mimetype": "image/jpeg",
"size": 334_593, "size": 334_593,
} }
], ],
"org.matrix.msc1767.caption": [ "m.caption": [
{ {
"body": "This is my house", "body": "This is my house",
"mimetype": "text/plain", "mimetype": "text/plain",
@ -191,13 +191,13 @@ fn image_event_serialization() {
fn plain_content_deserialization() { fn plain_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_cat.png", "org.matrix.msc1767.text": "Upload: my_cat.png",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
}, },
"org.matrix.msc1767.image": { "m.image": {
"width": 668, "width": 668,
}, },
"org.matrix.msc1767.caption": [ "m.caption": [
{ {
"body": "Look at my cat!", "body": "Look at my cat!",
} }
@ -222,7 +222,7 @@ fn plain_content_deserialization() {
fn encrypted_content_deserialization() { fn encrypted_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_file.txt", "org.matrix.msc1767.text": "Upload: my_file.txt",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -237,8 +237,8 @@ fn encrypted_content_deserialization() {
}, },
"v": "v2" "v": "v2"
}, },
"org.matrix.msc1767.image": {}, "m.image": {},
"org.matrix.msc1767.thumbnail": [ "m.thumbnail": [
{ {
"url": "mxc://notareal.hs/thumbnail", "url": "mxc://notareal.hs/thumbnail",
} }
@ -265,13 +265,13 @@ fn message_event_deserialization() {
let json_data = json!({ let json_data = json!({
"content": { "content": {
"org.matrix.msc1767.text": "Upload: my_gnome.webp", "org.matrix.msc1767.text": "Upload: my_gnome.webp",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_gnome.webp", "name": "my_gnome.webp",
"mimetype": "image/webp", "mimetype": "image/webp",
"size": 123_774, "size": 123_774,
}, },
"org.matrix.msc1767.image": { "m.image": {
"width": 1300, "width": 1300,
"height": 837, "height": 837,
} }

View File

@ -29,7 +29,7 @@ fn plain_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Alice was at geo:51.5008,0.1247;u=35", "org.matrix.msc1767.text": "Alice was at geo:51.5008,0.1247;u=35",
"org.matrix.msc3488.location": { "m.location": {
"uri": "geo:51.5008,0.1247;u=35", "uri": "geo:51.5008,0.1247;u=35",
}, },
}) })
@ -81,12 +81,12 @@ fn event_serialization() {
"mimetype": "text/plain", "mimetype": "text/plain",
}, },
], ],
"org.matrix.msc3488.location": { "m.location": {
"uri": "geo:51.5008,0.1247;u=35", "uri": "geo:51.5008,0.1247;u=35",
"description": "Alice's whereabouts", "description": "Alice's whereabouts",
"zoom_level": 4, "zoom_level": 4,
}, },
"org.matrix.msc3488.ts": 1_636_829_458, "m.ts": 1_636_829_458,
"m.relates_to": { "m.relates_to": {
"m.in_reply_to": { "m.in_reply_to": {
"event_id": "$replyevent:example.com", "event_id": "$replyevent:example.com",
@ -106,7 +106,7 @@ fn event_serialization() {
fn plain_content_deserialization() { fn plain_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Alice was at geo:51.5008,0.1247;u=35", "org.matrix.msc1767.text": "Alice was at geo:51.5008,0.1247;u=35",
"org.matrix.msc3488.location": { "m.location": {
"uri": "geo:51.5008,0.1247;u=35", "uri": "geo:51.5008,0.1247;u=35",
}, },
}); });
@ -173,12 +173,12 @@ fn message_event_deserialization() {
"org.matrix.msc1767.message": [ "org.matrix.msc1767.message": [
{ "body": "Alice was at geo:51.5008,0.1247;u=35 as of Sat Nov 13 18:50:58 2021" }, { "body": "Alice was at geo:51.5008,0.1247;u=35 as of Sat Nov 13 18:50:58 2021" },
], ],
"org.matrix.msc3488.location": { "m.location": {
"uri": "geo:51.5008,0.1247;u=35", "uri": "geo:51.5008,0.1247;u=35",
"description": "Alice's whereabouts", "description": "Alice's whereabouts",
"zoom_level": 4, "zoom_level": 4,
}, },
"org.matrix.msc3488.ts": 1_636_829_458, "m.ts": 1_636_829_458,
"m.relates_to": { "m.relates_to": {
"m.in_reply_to": { "m.in_reply_to": {
"event_id": "$replyevent:example.com", "event_id": "$replyevent:example.com",

View File

@ -37,10 +37,10 @@ fn plain_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_video.webm", "org.matrix.msc1767.text": "Upload: my_video.webm",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
}, },
"org.matrix.msc1767.video": {} "m.video": {}
}) })
); );
} }
@ -77,7 +77,7 @@ fn encrypted_content_serialization() {
to_json_value(&event_content).unwrap(), to_json_value(&event_content).unwrap(),
json!({ json!({
"org.matrix.msc1767.text": "Upload: my_video.webm", "org.matrix.msc1767.text": "Upload: my_video.webm",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -92,7 +92,7 @@ fn encrypted_content_serialization() {
}, },
"v": "v2" "v": "v2"
}, },
"org.matrix.msc1767.video": {} "m.video": {}
}) })
); );
} }
@ -158,25 +158,25 @@ fn event_serialization() {
{ "body": "Upload: <strong>my_lava_lamp.webm</strong>", "mimetype": "text/html"}, { "body": "Upload: <strong>my_lava_lamp.webm</strong>", "mimetype": "text/html"},
{ "body": "Upload: my_lava_lamp.webm", "mimetype": "text/plain"}, { "body": "Upload: my_lava_lamp.webm", "mimetype": "text/plain"},
], ],
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_lava_lamp.webm", "name": "my_lava_lamp.webm",
"mimetype": "video/webm", "mimetype": "video/webm",
"size": 1_897_774, "size": 1_897_774,
}, },
"org.matrix.msc1767.video": { "m.video": {
"width": 1920, "width": 1920,
"height": 1080, "height": 1080,
"duration": 15_000, "duration": 15_000,
}, },
"org.matrix.msc1767.thumbnail": [ "m.thumbnail": [
{ {
"url": "mxc://notareal.hs/thumbnail", "url": "mxc://notareal.hs/thumbnail",
"mimetype": "image/jpeg", "mimetype": "image/jpeg",
"size": 334_593, "size": 334_593,
} }
], ],
"org.matrix.msc1767.caption": [ "m.caption": [
{ {
"body": "This is my awesome vintage lava lamp", "body": "This is my awesome vintage lava lamp",
"mimetype": "text/plain", "mimetype": "text/plain",
@ -201,13 +201,13 @@ fn event_serialization() {
fn plain_content_deserialization() { fn plain_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Video: my_cat.mp4", "org.matrix.msc1767.text": "Video: my_cat.mp4",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
}, },
"org.matrix.msc1767.video": { "m.video": {
"duration": 5_668, "duration": 5_668,
}, },
"org.matrix.msc1767.caption": [ "m.caption": [
{ {
"body": "Look at my cat!", "body": "Look at my cat!",
} }
@ -233,7 +233,7 @@ fn plain_content_deserialization() {
fn encrypted_content_deserialization() { fn encrypted_content_deserialization() {
let json_data = json!({ let json_data = json!({
"org.matrix.msc1767.text": "Upload: my_cat.mp4", "org.matrix.msc1767.text": "Upload: my_cat.mp4",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"key": { "key": {
"kty": "oct", "kty": "oct",
@ -248,8 +248,8 @@ fn encrypted_content_deserialization() {
}, },
"v": "v2" "v": "v2"
}, },
"org.matrix.msc1767.video": {}, "m.video": {},
"org.matrix.msc1767.thumbnail": [ "m.thumbnail": [
{ {
"url": "mxc://notareal.hs/thumbnail", "url": "mxc://notareal.hs/thumbnail",
} }
@ -277,13 +277,13 @@ fn message_event_deserialization() {
let json_data = json!({ let json_data = json!({
"content": { "content": {
"org.matrix.msc1767.text": "Upload: my_gnome.webm", "org.matrix.msc1767.text": "Upload: my_gnome.webm",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "my_gnome.webm", "name": "my_gnome.webm",
"mimetype": "video/webm", "mimetype": "video/webm",
"size": 123_774, "size": 123_774,
}, },
"org.matrix.msc1767.video": { "m.video": {
"width": 1300, "width": 1300,
"height": 837, "height": 837,
} }

View File

@ -60,16 +60,16 @@ fn event_serialization() {
json!({ json!({
"content": { "content": {
"org.matrix.msc1767.text": "Voice message", "org.matrix.msc1767.text": "Voice message",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "voice_message.ogg", "name": "voice_message.ogg",
"mimetype": "audio/opus", "mimetype": "audio/opus",
"size": 897_774, "size": 897_774,
}, },
"org.matrix.msc1767.audio": { "m.audio": {
"duration": 23_000, "duration": 23_000,
}, },
"org.matrix.msc3245.voice": {}, "m.voice": {},
"m.relates_to": { "m.relates_to": {
"m.in_reply_to": { "m.in_reply_to": {
"event_id": "$replyevent:example.com" "event_id": "$replyevent:example.com"
@ -90,16 +90,16 @@ fn message_event_deserialization() {
let json_data = json!({ let json_data = json!({
"content": { "content": {
"org.matrix.msc1767.text": "Voice message", "org.matrix.msc1767.text": "Voice message",
"org.matrix.msc1767.file": { "m.file": {
"url": "mxc://notareal.hs/abcdef", "url": "mxc://notareal.hs/abcdef",
"name": "voice_message.ogg", "name": "voice_message.ogg",
"mimetype": "audio/opus", "mimetype": "audio/opus",
"size": 123_774, "size": 123_774,
}, },
"org.matrix.msc1767.audio": { "m.audio": {
"duration": 5_300, "duration": 5_300,
}, },
"org.matrix.msc3245.voice": {}, "m.voice": {},
}, },
"event_id": "$event:notareal.hs", "event_id": "$event:notareal.hs",
"origin_server_ts": 134_829_848, "origin_server_ts": 134_829_848,