31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1 | mod support; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 3 | use std::time::Duration; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 4 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 5 | use macltok::{ |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 6 | ConnectionState, Engine, EngineConfig, EngineError, Event, PackUsage, Retain, RoomMembership, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 7 | Termination, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 8 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 9 | use matrix_sdk::{ |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 10 | ruma::{api::client::sync::sync_events::v5, events::AnySyncStateEvent, room_id, serde::Raw}, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 11 | test_utils::mocks::MatrixMockServer, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 12 | }; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 13 | use matrix_sdk_test::JoinedRoomBuilder; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 14 | use serde_json::json; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 15 | use tokio::sync::watch; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 16 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 17 | #[tokio::test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 18 | async fn rooms_changed_invalidates_room_summaries() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 19 | let server = MatrixMockServer::new().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 20 | server |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 21 | .mock_sliding_sync() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 22 | .ok(v5::Response::new("1".to_owned())) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 23 | .mount() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 24 | .await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 25 | let client = server.client_builder().build().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 26 | let room_id = room_id!("!state:localhost"); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 27 | server.mock_room_state_encryption().plain().mount().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 28 | server.sync_joined_room(&client, room_id).await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 29 | let config = EngineConfig::default().with_initial_history_limit(0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 30 | let (engine, handle, mut events) = Engine::from_client(client, config).await.unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 31 | let running = tokio::spawn(engine.run()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 32 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 33 | support::receive_until(&mut events, |event| matches!(event, Event::RoomsChanged)).await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 34 | let rooms = handle.rooms().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 35 | let summary = rooms |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 36 | .iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 37 | .find(|summary| summary.room_id == room_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 38 | .expect("synced room was absent from the room summaries"); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 39 | assert_eq!(summary.membership, RoomMembership::Joined); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 40 | assert!(!summary.name.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 41 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 42 | support::shut_down(&handle, &mut events, running).await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 43 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 44 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 45 | #[tokio::test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 46 | async fn connection_watch_tracks_the_engine_lifecycle() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 47 | let server = MatrixMockServer::new().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 48 | server |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 49 | .mock_sliding_sync() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 50 | .ok(v5::Response::new("1".to_owned())) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 51 | .mount() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 52 | .await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 53 | let client = server.client_builder().build().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 54 | let config = EngineConfig::default().with_initial_history_limit(0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 55 | let (engine, handle, mut events) = Engine::from_client(client, config).await.unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 56 | let mut connection = handle.connection_state(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 57 | let connection_peer = connection.clone(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 58 | assert_eq!(*connection.borrow(), ConnectionState::Idle); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 59 | assert_eq!(*connection_peer.borrow(), ConnectionState::Idle); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 60 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 61 | let running = tokio::spawn(engine.run()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 62 | support::receive_until(&mut events, |event| { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 63 | matches!(event, Event::ConnectionChanged(ConnectionState::Connecting)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 64 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 65 | .await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 66 | assert_ne!(*connection.borrow(), ConnectionState::Idle); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 67 | support::receive_until(&mut events, |event| { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 68 | matches!(event, Event::ConnectionChanged(ConnectionState::Online)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 69 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 70 | .await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 71 | wait_for_connection(&mut connection, ConnectionState::Online).await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 72 | assert_eq!(*connection_peer.borrow(), ConnectionState::Online); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 73 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 74 | support::shut_down(&handle, &mut events, running).await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 75 | wait_for_connection(&mut connection, ConnectionState::Stopped).await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 76 | assert_eq!(*connection_peer.borrow(), ConnectionState::Stopped); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 77 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 78 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 79 | #[tokio::test] |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 80 | async fn soft_logout_says_so_and_stops_the_engine() { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 81 | let server = MatrixMockServer::new().await; |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 82 | server |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 83 | .mock_sliding_sync() |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 84 | .error_unknown_token(true) |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 85 | .mount() |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 86 | .await; |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 87 | let client = server.client_builder().build().await; |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 88 | let (engine, _handle, mut events) = Engine::from_client( |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 89 | client, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 90 | EngineConfig::default().with_initial_history_limit(0), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 91 | ) |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 92 | .await |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 93 | .unwrap(); |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 94 | let running = tokio::spawn(engine.run()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 95 | support::receive_until(&mut events, |event| { |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 96 | matches!( |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 97 | event, |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 98 | Event::SessionAccessRejected { |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 99 | soft_logout: Some(_) |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 100 | } |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 101 | ) |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 102 | }) |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 103 | .await; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 104 | support::receive_until(&mut events, |event| matches!(event, Event::Stopped)).await; |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 105 | let termination = running.await.unwrap().unwrap(); |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 106 | assert!(matches!(termination, Termination::SoftLoggedOut { .. })); |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 107 | assert_eq!(termination.retain(), Retain::Store); |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 108 | } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 109 | |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 110 | #[tokio::test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 111 | async fn closing_the_event_stream_stops_an_idle_engine() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 112 | let server = MatrixMockServer::new().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 113 | server |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 114 | .mock_sliding_sync() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 115 | .ok(v5::Response::new("1".to_owned())) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 116 | .mount() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 117 | .await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 118 | let client = server.client_builder().build().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 119 | let (engine, handle, mut events) = Engine::from_client( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 120 | client, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 121 | EngineConfig::default().with_initial_history_limit(0), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 122 | ) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 123 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 124 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 125 | let running = tokio::spawn(engine.run()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 126 | support::receive_until(&mut events, |event| { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 127 | matches!(event, Event::ConnectionChanged(ConnectionState::Online)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 128 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 129 | .await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 130 | drop(events); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 131 | let result = tokio::time::timeout(Duration::from_secs(2), running) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 132 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 133 | .expect("engine did not stop after its event receiver closed") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 134 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 135 | assert!(matches!(result, Err(EngineError::EventReceiverClosed))); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 136 | drop(handle); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 137 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 138 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 139 | async fn wait_for_connection( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 140 | connection: &mut watch::Receiver<ConnectionState>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 141 | expected: ConnectionState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 142 | ) { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 143 | tokio::time::timeout(Duration::from_secs(2), async { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 144 | loop { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 145 | if *connection.borrow_and_update() == expected { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 146 | return; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 147 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 148 | connection |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 149 | .changed() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 150 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 151 | .expect("connection watch closed before the expected state"); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 152 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 153 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 154 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 155 | .expect("expected connection state did not arrive"); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 156 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 157 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 158 | #[tokio::test] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 159 | async fn image_packs_follow_room_state_and_account_data() { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 160 | let server = MatrixMockServer::new().await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 161 | server |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 162 | .mock_sliding_sync() |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 163 | .ok(v5::Response::new("1".to_owned())) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 164 | .mount() |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 165 | .await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 166 | let client = server.client_builder().build().await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 167 | let room_id = room_id!("!packs:localhost"); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 168 | server.mock_room_state_encryption().plain().mount().await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 169 | server.sync_joined_room(&client, room_id).await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 170 | let config = EngineConfig::default().with_initial_history_limit(0); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 171 | let (engine, handle, mut events) = Engine::from_client(client.clone(), config).await.unwrap(); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 172 | let running = tokio::spawn(engine.run()); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 173 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 174 | let pack: Raw<AnySyncStateEvent> = serde_json::from_value(json!({ |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 175 | "type": "im.ponies.room_emotes", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 176 | "state_key": "cats", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 177 | "event_id": "$pack", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 178 | "sender": "@example:localhost", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 179 | "origin_server_ts": 1, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 180 | "content": { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 181 | "pack": { "display_name": "cats", "usage": ["emoticon"] }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 182 | "images": { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 183 | "blep": { "url": "mxc://localhost/blep" }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 184 | "broken": { "url": "not an mxc" }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 185 | "sticker": { "url": "mxc://localhost/sticker", "usage": ["sticker"] }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 186 | }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 187 | }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 188 | })) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 189 | .unwrap(); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 190 | server |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 191 | .mock_sync() |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 192 | .ok_and_run(&client, |builder| { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 193 | builder.add_joined_room(JoinedRoomBuilder::new(room_id).add_state_event(pack)); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 194 | builder.add_custom_global_account_data(json!({ |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 195 | "type": "im.ponies.emote_rooms", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 196 | "content": { "rooms": { "!packs:localhost": { "cats": {} } } }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 197 | })); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 198 | }) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 199 | .await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 200 | support::receive_until(&mut events, |event| { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 201 | matches!(event, Event::ImagePacksChanged) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 202 | }) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 203 | .await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 204 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 205 | let packs = handle.image_packs().await.unwrap(); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 206 | let offered = packs.for_room(Some(room_id)); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 207 | assert_eq!(offered.len(), 1, "an enabled room's pack was offered twice"); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 208 | let pack = offered[0]; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 209 | assert_eq!(pack.id, "room:!packs:localhost:cats"); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 210 | assert_eq!(packs.global, vec![pack.clone()]); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 211 | let images: Vec<_> = pack |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 212 | .images |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 213 | .iter() |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 214 | .map(|image| { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 215 | ( |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 216 | image.shortcode.as_str(), |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 217 | image.reaction_key.as_str(), |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 218 | image.usage.clone(), |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 219 | ) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 220 | }) |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 221 | .collect(); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 222 | assert_eq!( |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 223 | images, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 224 | [ |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 225 | ("blep", "mxc://localhost/blep", vec![PackUsage::Emoticon]), |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 226 | ( |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 227 | "sticker", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 228 | "mxc://localhost/sticker", |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 229 | vec![PackUsage::Sticker] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 230 | ), |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 231 | ] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 232 | ); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 233 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 234 | support::shut_down(&handle, &mut events, running).await; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 235 | } |