Browse Source

chore: Upgrade matrix-sdk crate

Should get rid of unwanted verbose warnings in the SDK.
fractal-9
Kévin Commaille 1 year ago
parent
commit
0b044491a1
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 122
      Cargo.lock
  2. 6
      Cargo.toml
  3. 2
      src/session/view/content/room_history/item_row.rs
  4. 8
      src/session/view/content/room_history/message_row/content.rs
  5. 38
      src/utils/matrix/media_message.rs

122
Cargo.lock generated

@ -243,9 +243,9 @@ dependencies = [
[[package]]
name = "async-once-cell"
version = "0.5.3"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb"
checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a"
[[package]]
name = "async-process"
@ -635,9 +635,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.1.24"
version = "1.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938"
checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1"
dependencies = [
"jobserver",
"libc",
@ -1403,9 +1403,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
dependencies = [
"futures-channel",
"futures-core",
@ -1418,9 +1418,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
@ -1428,15 +1428,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-executor"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
dependencies = [
"futures-core",
"futures-task",
@ -1445,9 +1445,9 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-lite"
@ -1464,9 +1464,9 @@ dependencies = [
[[package]]
name = "futures-macro"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
@ -1475,21 +1475,21 @@ dependencies = [
[[package]]
name = "futures-sink"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
[[package]]
name = "futures-util"
version = "0.3.30"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-channel",
"futures-core",
@ -1881,9 +1881,9 @@ dependencies = [
[[package]]
name = "growable-bloom-filter"
version = "2.1.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c669fa03050eb3445343f215d62fc1ab831e8098bc9a55f26e9724faff11075c"
checksum = "d174ccb4ba660d431329e7f0797870d0a4281e36353ec4b4a3c5eab6c2cfb6f1"
dependencies = [
"serde",
"serde_bytes",
@ -2333,9 +2333,9 @@ dependencies = [
[[package]]
name = "html5ever"
version = "0.28.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ff6858c1f7e2a470c5403091866fa95b36fe0dbac5d771f932c15e5ff1ee501"
checksum = "2e15626aaf9c351bc696217cbe29cb9b5e86c43f8a46b5e2f5c6c5cf7cb904ce"
dependencies = [
"log",
"mac",
@ -2998,9 +2998,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "markup5ever"
version = "0.13.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d581ff8be69d08a2efa23a959d81aa22b739073f749f067348bd4f4ba4b69195"
checksum = "82c88c6129bd24319e62a0359cb6b958fa7e8be6e19bb1663bc396b90883aca5"
dependencies = [
"log",
"phf",
@ -3051,7 +3051,7 @@ dependencies = [
[[package]]
name = "matrix-sdk"
version = "0.7.1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"anymap2",
"aquamarine",
@ -3101,7 +3101,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-base"
version = "0.7.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"as_variant",
"async-trait",
@ -3125,7 +3125,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-common"
version = "0.7.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"async-trait",
"futures-core",
@ -3146,7 +3146,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-crypto"
version = "0.7.2"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"aes",
"as_variant",
@ -3187,7 +3187,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-indexeddb"
version = "0.7.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"anyhow",
"async-trait",
@ -3215,7 +3215,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-qrcode"
version = "0.7.1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"byteorder",
"qrcode",
@ -3227,7 +3227,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-sqlite"
version = "0.7.1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"async-trait",
"deadpool-sqlite",
@ -3249,7 +3249,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-store-encryption"
version = "0.7.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"base64",
"blake3",
@ -3268,7 +3268,7 @@ dependencies = [
[[package]]
name = "matrix-sdk-ui"
version = "0.7.0"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=65b422312c27a1b7f5a8e25f1156d1a1d6691cc1#65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
source = "git+https://github.com/matrix-org/matrix-rust-sdk.git?rev=a12a46b77706bf9ff4f034c50668b06d079dd296#a12a46b77706bf9ff4f034c50668b06d079dd296"
dependencies = [
"as_variant",
"async-once-cell",
@ -3603,12 +3603,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.20.1"
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
dependencies = [
"portable-atomic",
]
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "oo7"
@ -3853,18 +3850,18 @@ dependencies = [
[[package]]
name = "pin-project"
version = "1.1.5"
version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.5"
version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8"
dependencies = [
"proc-macro2",
"quote",
@ -3964,12 +3961,6 @@ dependencies = [
"universal-hash",
]
[[package]]
name = "portable-atomic"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
[[package]]
name = "powerfmt"
version = "0.2.0"
@ -4311,7 +4302,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.10.1"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"assign",
"js_int",
@ -4328,7 +4319,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.18.0"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"as_variant",
"assign",
@ -4351,7 +4342,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.13.0"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"as_variant",
"base64",
@ -4383,7 +4374,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.28.1"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"as_variant",
"indexmap",
@ -4408,7 +4399,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.9.0"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"http",
"js_int",
@ -4422,7 +4413,7 @@ dependencies = [
[[package]]
name = "ruma-html"
version = "0.2.0"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"as_variant",
"html5ever",
@ -4435,7 +4426,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.9.5"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"js_int",
"thiserror",
@ -4444,7 +4435,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.13.0"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"cfg-if",
"once_cell",
@ -4460,7 +4451,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.9.0"
source = "git+https://github.com/ruma/ruma.git?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
source = "git+https://github.com/ruma/ruma.git?rev=b1c9a32f26f7aa76e20f96dbbb113250ed979112#b1c9a32f26f7aa76e20f96dbbb113250ed979112"
dependencies = [
"js_int",
"ruma-common",
@ -4546,9 +4537,9 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "schannel"
version = "0.1.24"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b"
checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1"
dependencies = [
"windows-sys 0.59.0",
]
@ -5446,8 +5437,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "vodozemac"
version = "0.7.0"
source = "git+https://github.com/matrix-org/vodozemac?rev=57cbf7e939d7b54d20207e8361b7135bd65c9cc2#57cbf7e939d7b54d20207e8361b7135bd65c9cc2"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7761890811f1dfe2ebef5e630add0a98597682ebf4e4477d98fb8d2e9172ac"
dependencies = [
"aes",
"arrayvec",

6
Cargo.toml

@ -67,7 +67,7 @@ sourceview = { package = "sourceview5", version = "0.9" }
[dependencies.matrix-sdk]
git = "https://github.com/matrix-org/matrix-rust-sdk.git"
rev = "65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
rev = "a12a46b77706bf9ff4f034c50668b06d079dd296"
features = [
"socks",
"sso-login",
@ -77,12 +77,12 @@ features = [
[dependencies.matrix-sdk-ui]
git = "https://github.com/matrix-org/matrix-rust-sdk.git"
rev = "65b422312c27a1b7f5a8e25f1156d1a1d6691cc1"
rev = "a12a46b77706bf9ff4f034c50668b06d079dd296"
[dependencies.ruma]
# version = "0.10"
git = "https://github.com/ruma/ruma.git"
rev = "1ae98db9c44f46a590f4c76baf5cef70ebb6970d"
rev = "b1c9a32f26f7aa76e20f96dbbb113250ed979112"
features = [
"unstable-unspecified",
"client-api-c",

2
src/session/view/content/room_history/item_row.rs

@ -813,6 +813,8 @@ impl ItemRow {
if let Some(media_message) = MediaMessage::from_message(message.msgtype()) {
if let Some((caption, _)) = media_message.caption() {
let caption = caption.to_owned();
// Copy caption.
action_group.add_action_entries([gio::ActionEntry::builder("copy-text")
.activate(clone!(

8
src/session/view/content/room_history/message_row/content.rs

@ -381,7 +381,13 @@ fn build_media_message_content(
caption_widget
};
caption_widget.set_caption(caption, formatted_caption, room, format, detect_at_room);
caption_widget.set_caption(
caption.to_owned(),
formatted_caption.cloned(),
room,
format,
detect_at_room,
);
let new_widget =
build_media_content(caption_widget.child(), media_message, format, &session);

38
src/utils/matrix/media_message.rs

@ -25,10 +25,7 @@ use crate::{
/// Get the filename of a media message.
macro_rules! filename {
($message:ident, $mime_fallback:expr) => {{
let mut filename = match &$message.filename {
Some(filename) if *filename != $message.body => filename.clone(),
_ => $message.body.clone(),
};
let filename = $message.filename();
if filename.is_empty() {
let mimetype = $message
@ -36,21 +33,10 @@ macro_rules! filename {
.as_ref()
.and_then(|info| info.mimetype.as_deref());
filename = $crate::utils::media::filename_for_mime(mimetype, $mime_fallback);
$crate::utils::media::filename_for_mime(mimetype, $mime_fallback)
} else {
filename.to_owned()
}
filename
}};
}
/// Get the caption of a media message.
macro_rules! caption {
($message:ident) => {{
$message
.filename
.as_deref()
.filter(|filename| *filename != $message.body)
.map(|_| ($message.body.clone(), $message.formatted.clone()))
}};
}
@ -97,12 +83,12 @@ impl MediaMessage {
/// The caption of the media, if any.
///
/// Returns `Some((body, formatted_body))` if the media includes a caption.
pub fn caption(&self) -> Option<(String, Option<FormattedBody>)> {
pub fn caption(&self) -> Option<(&str, Option<&FormattedBody>)> {
match self {
Self::Audio(c) => caption!(c),
Self::File(c) => caption!(c),
Self::Image(c) => caption!(c),
Self::Video(c) => caption!(c),
Self::Audio(c) => c.caption().map(|caption| (caption, c.formatted.as_ref())),
Self::File(c) => c.caption().map(|caption| (caption, c.formatted.as_ref())),
Self::Image(c) => c.caption().map(|caption| (caption, c.formatted.as_ref())),
Self::Video(c) => c.caption().map(|caption| (caption, c.formatted.as_ref())),
Self::Sticker(_) => None,
}
}
@ -248,10 +234,10 @@ impl VisualMediaMessage {
/// The caption of the media, if any.
///
/// Returns `Some((body, formatted_body))` if the media includes a caption.
pub fn caption(&self) -> Option<(String, Option<FormattedBody>)> {
pub fn caption(&self) -> Option<(&str, Option<&FormattedBody>)> {
match self {
Self::Image(c) => caption!(c),
Self::Video(c) => caption!(c),
Self::Image(c) => c.caption().map(|caption| (caption, c.formatted.as_ref())),
Self::Video(c) => c.caption().map(|caption| (caption, c.formatted.as_ref())),
Self::Sticker(_) => None,
}
}

Loading…
Cancel
Save