96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1 | use std::{ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2 | fmt, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 3 | future::Future, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 4 | pin::Pin, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 5 | sync::Arc, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 6 | task::{Context, Poll}, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 7 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 8 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 9 | use matrix_sdk::{Client, RoomMemberships}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 10 | use matrix_sdk_ui::{ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 11 | notification_client::{ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 12 | NotificationClient, NotificationProcessSetup, NotificationStatus, RawNotificationEvent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 13 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 14 | spaces::{SpaceRoomList, SpaceService, room_list::SpaceRoomListPaginationState}, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 15 | sync_service::SyncService, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 16 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 17 | use ruma::{ |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 18 | EventId, MxcUri, OwnedDeviceId, OwnedEventId, OwnedMxcUri, OwnedRoomId, OwnedRoomOrAliasId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 19 | OwnedServerName, OwnedTransactionId, OwnedUserId, RoomId, UserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 20 | events::{ |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 21 | AnyGlobalAccountDataEventContent, AnyRoomAccountDataEvent, AnyRoomAccountDataEventContent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 22 | GlobalAccountDataEventType, RoomAccountDataEventType, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 23 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 24 | serde::Raw, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 25 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 26 | use tokio::sync::{OnceCell, mpsc, oneshot, watch}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 27 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 28 | use crate::{ |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 29 | AccountCommand, AttachmentUpload, Command, CommandOutput, ConnectionState, CreateRoomOptions, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 30 | EncryptionCommand, EncryptionState, Error, ErrorKind, Event, EventRef, InteractiveAuth, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 31 | InteractiveAuthOutcome, LifecycleCommand, Media, MediaCommand, MediaId, MediaLocation, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 32 | MediaSize, MemberFilter, MemberSummary, MessageContent, MessageEditContent, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 33 | NotificationCommand, OwnDevice, PowerLevelChanges, Profile, PushNotification, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 34 | PushNotificationEvent, PushNotificationStatus, RoomCommand, RoomListFilter, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 35 | RoomNotificationMode, RoomNotificationSettings, RoomPowerLevels, RoomSummary, SpaceChild, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 36 | TimelineCommand, TimelineId, VerificationAction, VerificationTarget, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 37 | encryption::encryption_state, |
a250c7fa43fb | atagen | 2026-09-26 13:35 UTC | 38 | engine::{MediaService, StoreLock}, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 39 | model::{PushNotificationRoom, PushNotificationSender}, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 40 | normalise::{member_summary, room_summaries, space_child}, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 41 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 42 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 43 | #[derive(Clone)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 44 | pub struct ClientHandle { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 45 | requests: mpsc::Sender<Request>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 46 | client: Client, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 47 | connection: watch::Receiver<ConnectionState>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 48 | notification_client: Arc<OnceCell<NotificationClient>>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 49 | sync_service: Arc<SyncService>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 50 | media: Arc<MediaService>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 51 | spaces: Arc<OnceCell<SpaceService>>, |
a250c7fa43fb | atagen | 2026-09-26 13:35 UTC | 52 | _store_lock: Option<Arc<StoreLock>>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 53 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 54 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 55 | impl fmt::Debug for ClientHandle { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 56 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 57 | formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 58 | .debug_struct("ClientHandle") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 59 | .finish_non_exhaustive() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 60 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 61 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 62 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 63 | /// a command's answer. drop it if you don't care, the command still runs |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 64 | #[derive(Debug)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 65 | #[must_use = "dropping it is fine but then you'll never know"] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 66 | pub struct Pending(oneshot::Receiver<Result<CommandOutput, Error>>); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 67 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 68 | impl Future for Pending { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 69 | type Output = Result<CommandOutput, Error>; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 70 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 71 | fn poll(mut self: Pin<&mut Self>, context: &mut Context<'_>) -> Poll<Self::Output> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 72 | Pin::new(&mut self.0) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 73 | .poll(context) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 74 | .map(|result| result.unwrap_or_else(|_| Err(Error::interrupted()))) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 75 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 76 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 77 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 78 | impl ClientHandle { |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 79 | /// current credentials, it holds secrets. the engine saves it for you unless the |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 80 | /// session was built `without_persistence` |
62fe32759529 | atagen | 2026-09-26 08:50 UTC | 81 | #[cfg(any(feature = "sqlite", feature = "indexeddb"))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 82 | pub fn session_record(&self) -> Result<crate::SessionRecord, crate::AccountError> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 83 | crate::account::session_record(&self.client) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 84 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 85 | |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 86 | /// the bearer token. it rotates on every refresh so ask again after a 401 rather than |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 87 | /// keeping it, and keep it in memory and away from all but the homeserver's media endpoints |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 88 | pub fn access_token(&self) -> Option<String> { |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 89 | self.client.access_token() |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 90 | } |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 91 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 92 | /// queue a command, waiting for room in the queue if there isn't any |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 93 | pub async fn send(&self, command: Command) -> Result<Pending, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 94 | let (request, pending) = Request::new(command); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 95 | self.requests |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 96 | .send(request) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 97 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 98 | .map_err(|_| Error::interrupted())?; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 99 | Ok(pending) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 100 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 101 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 102 | /// queue a command or fail with `QueueFull` right now |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 103 | pub fn try_send(&self, command: Command) -> Result<Pending, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 104 | let (request, pending) = Request::new(command); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 105 | self.requests |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 106 | .try_send(request) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 107 | .map_err(|error| match error { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 108 | mpsc::error::TrySendError::Full(_) => { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 109 | Error::new(ErrorKind::QueueFull, "the command queue is full") |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 110 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 111 | mpsc::error::TrySendError::Closed(_) => Error::interrupted(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 112 | })?; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 113 | Ok(pending) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 114 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 115 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 116 | /// queue a command and wait for its answer. timeline sends answer once the |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 117 | /// sdk send queue has them, delivery shows up later as the item's send state |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 118 | pub async fn execute(&self, command: Command) -> Result<CommandOutput, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 119 | self.send(command).await?.await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 120 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 121 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 122 | async fn run(&self, command: Command) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 123 | self.execute(command).await.map(drop) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 124 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 125 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 126 | async fn run_for_room(&self, command: RoomCommand) -> Result<OwnedRoomId, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 127 | match self.execute(Command::Room(command)).await? { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 128 | CommandOutput::Room(room_id) => Ok(room_id), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 129 | output => Err(Error::new( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 130 | ErrorKind::Other, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 131 | format!("expected a room but got {output:?}"), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 132 | )), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 133 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 134 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 135 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 136 | pub async fn shutdown(&self) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 137 | self.run(Command::Lifecycle(LifecycleCommand::Shutdown)) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 138 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 139 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 140 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 141 | pub async fn logout(&self) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 142 | self.run(Command::Account(AccountCommand::Logout)).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 143 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 144 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 145 | pub async fn delete_devices( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 146 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 147 | device_ids: Vec<OwnedDeviceId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 148 | auth: Option<InteractiveAuth>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 149 | ) -> Result<InteractiveAuthOutcome, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 150 | match self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 151 | .run(Command::Account(AccountCommand::DeleteDevices { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 152 | device_ids, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 153 | auth, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 154 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 155 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 156 | { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 157 | Ok(()) => Ok(InteractiveAuthOutcome::Completed), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 158 | Err(Error { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 159 | challenge: Some(challenge), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 160 | .. |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 161 | }) => Ok(InteractiveAuthOutcome::Challenge(*challenge)), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 162 | Err(error) => Err(error), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 163 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 164 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 165 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 166 | pub async fn rename_device( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 167 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 168 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 169 | display_name: impl Into<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 170 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 171 | self.run(Command::Account(AccountCommand::RenameDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 172 | device_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 173 | display_name: display_name.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 174 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 175 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 176 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 177 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 178 | pub async fn set_global_account_data( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 179 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 180 | event_type: GlobalAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 181 | content: Raw<AnyGlobalAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 182 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 183 | self.run(Command::Account(AccountCommand::SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 184 | event_type, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 185 | content, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 186 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 187 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 188 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 189 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 190 | pub async fn set_room_account_data( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 191 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 192 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 193 | event_type: RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 194 | content: Raw<AnyRoomAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 195 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 196 | self.run(Command::Room(RoomCommand::SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 197 | room_id, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 198 | event_type, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 199 | content, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 200 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 201 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 202 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 203 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 204 | pub async fn set_room_notification_mode( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 205 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 206 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 207 | mode: RoomNotificationMode, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 208 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 209 | self.run(Command::Notification(NotificationCommand::SetRoomMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 210 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 211 | mode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 212 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 213 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 214 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 215 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 216 | pub async fn reset_room_notification_mode(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 217 | self.run(Command::Notification(NotificationCommand::ResetRoomMode( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 218 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 219 | ))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 220 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 221 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 222 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 223 | pub async fn set_default_notification_mode( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 224 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 225 | encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 226 | one_to_one: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 227 | mode: RoomNotificationMode, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 228 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 229 | self.run(Command::Notification(NotificationCommand::SetDefaultMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 230 | encrypted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 231 | one_to_one, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 232 | mode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 233 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 234 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 235 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 236 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 237 | pub async fn add_notification_keyword(&self, keyword: impl Into<String>) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 238 | self.run(Command::Notification(NotificationCommand::AddKeyword( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 239 | keyword.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 240 | ))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 241 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 242 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 243 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 244 | pub async fn remove_notification_keyword( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 245 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 246 | keyword: impl Into<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 247 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 248 | self.run(Command::Notification(NotificationCommand::RemoveKeyword( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 249 | keyword.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 250 | ))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 251 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 252 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 253 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 254 | pub async fn open_room(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 255 | self.run(Command::Room(RoomCommand::Open(room_id))).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 256 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 257 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 258 | pub async fn close_room(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 259 | self.run(Command::Room(RoomCommand::Close(room_id))).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 260 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 261 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 262 | pub async fn open_thread( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 263 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 264 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 265 | root_event_id: OwnedEventId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 266 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 267 | self.run(Command::Timeline(TimelineCommand::OpenThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 268 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 269 | root_event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 270 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 271 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 272 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 273 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 274 | pub async fn close_thread( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 275 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 276 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 277 | root_event_id: OwnedEventId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 278 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 279 | self.run(Command::Timeline(TimelineCommand::CloseThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 280 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 281 | root_event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 282 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 283 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 284 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 285 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 286 | pub async fn resync(&self, timeline_id: TimelineId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 287 | self.run(Command::Timeline(TimelineCommand::Resync { timeline_id })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 288 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 289 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 290 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 291 | pub async fn paginate(&self, timeline_id: TimelineId, limit: u16) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 292 | self.run(Command::Timeline(TimelineCommand::Paginate { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 293 | timeline_id, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 294 | limit, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 295 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 296 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 297 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 298 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 299 | pub async fn send_message( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 300 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 301 | timeline_id: TimelineId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 302 | content: MessageContent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 303 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 304 | self.run(Command::Timeline(TimelineCommand::Send { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 305 | timeline_id, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 306 | content, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 307 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 308 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 309 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 310 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 311 | pub async fn edit_message( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 312 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 313 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 314 | target: impl Into<EventRef>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 315 | content: MessageEditContent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 316 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 317 | self.run(Command::Timeline(TimelineCommand::Edit { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 318 | timeline_id, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 319 | target: target.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 320 | content, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 321 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 322 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 323 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 324 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 325 | pub async fn redact( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 326 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 327 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 328 | target: impl Into<EventRef>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 329 | reason: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 330 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 331 | self.run(Command::Timeline(TimelineCommand::Redact { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 332 | timeline_id, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 333 | target: target.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 334 | reason, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 335 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 336 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 337 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 338 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 339 | pub async fn toggle_reaction( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 340 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 341 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 342 | target: impl Into<EventRef>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 343 | key: impl Into<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 344 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 345 | self.run(Command::Timeline(TimelineCommand::ToggleReaction { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 346 | timeline_id, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 347 | target: target.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 348 | key: key.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 349 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 350 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 351 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 352 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 353 | pub async fn mark_read( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 354 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 355 | timeline_id: TimelineId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 356 | event_id: OwnedEventId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 357 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 358 | self.run(Command::Timeline(TimelineCommand::MarkRead { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 359 | timeline_id, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 360 | event_id, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 361 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 362 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 363 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 364 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 365 | pub async fn set_typing(&self, room_id: OwnedRoomId, typing: bool) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 366 | self.run(Command::Room(RoomCommand::SetTyping { room_id, typing })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 367 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 368 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 369 | |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 370 | pub async fn prepare_to_send(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 371 | self.run(Command::Room(RoomCommand::PrepareToSend(room_id))) |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 372 | .await |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 373 | } |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 374 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 375 | pub async fn join_room( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 376 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 377 | room: OwnedRoomOrAliasId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 378 | via: Vec<OwnedServerName>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 379 | ) -> Result<OwnedRoomId, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 380 | self.run_for_room(RoomCommand::Join { room, via }).await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 381 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 382 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 383 | pub async fn leave_room(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 384 | self.run(Command::Room(RoomCommand::Leave(room_id))).await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 385 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 386 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 387 | pub async fn forget_room(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 388 | self.run(Command::Room(RoomCommand::Forget(room_id))).await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 389 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 390 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 391 | pub async fn accept_invite(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 392 | self.run(Command::Room(RoomCommand::AcceptInvite(room_id))) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 393 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 394 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 395 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 396 | pub async fn reject_invite(&self, room_id: OwnedRoomId) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 397 | self.run(Command::Room(RoomCommand::RejectInvite(room_id))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 398 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 399 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 400 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 401 | pub async fn invite_user( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 402 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 403 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 404 | user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 405 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 406 | self.run(Command::Room(RoomCommand::InviteUser { room_id, user_id })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 407 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 408 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 409 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 410 | pub async fn kick_user( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 411 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 412 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 413 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 414 | reason: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 415 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 416 | self.run(Command::Room(RoomCommand::KickUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 417 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 418 | user_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 419 | reason, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 420 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 421 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 422 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 423 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 424 | pub async fn ban_user( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 425 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 426 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 427 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 428 | reason: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 429 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 430 | self.run(Command::Room(RoomCommand::BanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 431 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 432 | user_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 433 | reason, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 434 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 435 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 436 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 437 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 438 | pub async fn unban_user( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 439 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 440 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 441 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 442 | reason: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 443 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 444 | self.run(Command::Room(RoomCommand::UnbanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 445 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 446 | user_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 447 | reason, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 448 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 449 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 450 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 451 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 452 | pub async fn set_power_levels( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 453 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 454 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 455 | changes: PowerLevelChanges, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 456 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 457 | self.run(Command::Room(RoomCommand::SetPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 458 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 459 | changes, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 460 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 461 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 462 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 463 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 464 | pub async fn set_user_power_level( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 465 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 466 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 467 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 468 | level: i64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 469 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 470 | self.run(Command::Room(RoomCommand::SetUserPowerLevel { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 471 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 472 | user_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 473 | level, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 474 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 475 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 476 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 477 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 478 | pub async fn create_room(&self, options: CreateRoomOptions) -> Result<OwnedRoomId, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 479 | self.run_for_room(RoomCommand::Create(options)).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 480 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 481 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 482 | /// hands back the existing dm with them if there is one |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 483 | pub async fn create_direct(&self, user_id: OwnedUserId) -> Result<OwnedRoomId, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 484 | self.run_for_room(RoomCommand::CreateDirect(user_id)).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 485 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 486 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 487 | pub async fn cancel_send( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 488 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 489 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 490 | transaction_id: OwnedTransactionId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 491 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 492 | self.run(Command::Room(RoomCommand::CancelSend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 493 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 494 | transaction_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 495 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 496 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 497 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 498 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 499 | pub async fn retry_send( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 500 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 501 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 502 | transaction_id: OwnedTransactionId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 503 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 504 | self.run(Command::Room(RoomCommand::RetrySend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 505 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 506 | transaction_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 507 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 508 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 509 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 510 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 511 | pub async fn upload(&self, upload: AttachmentUpload) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 512 | self.run(Command::Media(MediaCommand::Upload(upload))).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 513 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 514 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 515 | pub async fn recover(&self, recovery_key: impl Into<String>) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 516 | self.run(Command::Encryption(EncryptionCommand::Recover( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 517 | recovery_key.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 518 | ))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 519 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 520 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 521 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 522 | pub async fn create_key_backup(&self) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 523 | self.run(Command::Encryption(EncryptionCommand::CreateKeyBackup)) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 524 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 525 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 526 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 527 | pub async fn enable_key_backup(&self) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 528 | self.run(Command::Encryption(EncryptionCommand::EnableKeyBackup)) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 529 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 530 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 531 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 532 | pub async fn disable_key_backup(&self, delete_from_server: bool) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 533 | self.run(Command::Encryption(EncryptionCommand::DisableKeyBackup { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 534 | delete_from_server, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 535 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 536 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 537 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 538 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 539 | pub async fn recover_key_backup(&self, recovery_key: impl Into<String>) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 540 | self.run(Command::Encryption(EncryptionCommand::RecoverKeyBackup( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 541 | recovery_key.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 542 | ))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 543 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 544 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 545 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 546 | pub async fn start_verification(&self, target: VerificationTarget) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 547 | self.run(Command::Encryption(EncryptionCommand::StartVerification( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 548 | target, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 549 | ))) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 550 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 551 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 552 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 553 | pub async fn verify(&self, action: VerificationAction) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 554 | self.run(Command::Encryption(EncryptionCommand::Verify(action))) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 555 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 556 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 557 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 558 | /// bytes for media a retained timeline showed you. concurrent asks share one download |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 559 | pub async fn media(&self, media_id: &MediaId, size: MediaSize) -> Result<Media, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 560 | self.media.timeline_media(media_id, size).await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 561 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 562 | |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 563 | /// where `media` would fetch from, for a host streaming big files itself. the byte cap |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 564 | /// doesn't apply since nothing is buffered |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 565 | pub async fn media_source( |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 566 | &self, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 567 | media_id: &MediaId, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 568 | size: MediaSize, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 569 | ) -> Result<MediaLocation, Error> { |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 570 | self.media.media_location(media_id, size).await |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 571 | } |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 572 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 573 | /// bytes for any plain mxc uri, avatars mostly. same byte cap as everything else |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 574 | pub async fn mxc_media(&self, uri: &MxcUri, size: MediaSize) -> Result<Media, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 575 | self.media.mxc_media(uri, size).await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 576 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 577 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 578 | /// the space graph builds on first use and then keeps itself current |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 579 | async fn spaces(&self) -> &SpaceService { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 580 | self.spaces |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 581 | .get_or_init(|| SpaceService::new(self.client.clone())) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 582 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 583 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 584 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 585 | pub async fn rooms(&self) -> Vec<RoomSummary> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 586 | room_summaries(&self.client, self.spaces().await).await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 587 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 588 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 589 | /// browse a space the way the server sees it, rooms you haven't joined included |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 590 | pub async fn space_hierarchy(&self, space_id: OwnedRoomId) -> SpaceHierarchy { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 591 | SpaceHierarchy(SpaceRoomList::new(self.client.clone(), space_id).await) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 592 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 593 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 594 | pub async fn own_profile(&self) -> Result<Profile, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 595 | let user_id = self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 596 | .client |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 597 | .user_id() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 598 | .ok_or_else(|| Error::new(ErrorKind::Unauthenticated, "the client is not logged in"))? |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 599 | .to_owned(); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 600 | let response = self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 601 | .client |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 602 | .account() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 603 | .fetch_user_profile() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 604 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 605 | .map_err(|source| Error::from_sdk("fetching the profile failed", source))?; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 606 | profile(user_id, &response) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 607 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 608 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 609 | pub async fn user_profile(&self, user_id: &UserId) -> Result<Profile, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 610 | let response = self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 611 | .client |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 612 | .account() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 613 | .fetch_user_profile_of(user_id) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 614 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 615 | .map_err(|source| Error::from_sdk("fetching the profile failed", source))?; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 616 | profile(user_id.to_owned(), &response) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 617 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 618 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 619 | pub async fn set_display_name(&self, name: Option<String>) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 620 | self.run(Command::Account(AccountCommand::SetDisplayName(name))) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 621 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 622 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 623 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 624 | pub async fn set_avatar(&self, avatar: Option<OwnedMxcUri>) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 625 | self.run(Command::Account(AccountCommand::SetAvatar(avatar))) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 626 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 627 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 628 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 629 | pub async fn upload_avatar( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 630 | &self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 631 | mimetype: impl Into<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 632 | bytes: Vec<u8>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 633 | ) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 634 | self.run(Command::Account(AccountCommand::UploadAvatar { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 635 | mimetype: mimetype.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 636 | bytes, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 637 | })) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 638 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 639 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 640 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 641 | pub async fn rooms_filtered(&self, filter: &RoomListFilter) -> Vec<RoomSummary> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 642 | let matcher = filter.matcher(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 643 | self.rooms() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 644 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 645 | .into_iter() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 646 | .filter(|room| matcher.matches(room)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 647 | .collect() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 648 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 649 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 650 | pub async fn devices(&self) -> Result<Vec<OwnDevice>, Error> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 651 | let current_device_id = self.client.device_id(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 652 | Ok(self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 653 | .client |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 654 | .devices() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 655 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 656 | .map_err(|source| Error::from_http("listing devices failed", source))? |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 657 | .devices |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 658 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 659 | .map(|device| OwnDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 660 | current: current_device_id == Some(device.device_id.as_ref()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 661 | device_id: device.device_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 662 | display_name: device.display_name, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 663 | last_seen_ip: device.last_seen_ip, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 664 | last_seen_timestamp_ms: device.last_seen_ts.map(|timestamp| timestamp.get().into()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 665 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 666 | .collect()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 667 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 668 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 669 | fn room(&self, room_id: &RoomId) -> Result<matrix_sdk::Room, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 670 | self.client |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 671 | .get_room(room_id) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 672 | .ok_or_else(Error::room_unknown) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 673 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 674 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 675 | pub async fn room_notification_settings( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 676 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 677 | room_id: &RoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 678 | ) -> Result<Option<RoomNotificationSettings>, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 679 | let room = self.room(room_id)?; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 680 | let custom = room.user_defined_notification_mode().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 681 | let mode = match custom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 682 | Some(mode) => mode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 683 | None => match room.notification_mode().await { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 684 | Some(mode) => mode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 685 | None => return Ok(None), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 686 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 687 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 688 | Ok(Some(RoomNotificationSettings { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 689 | mode: crate::normalise::notification_mode(mode), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 690 | custom: custom.is_some(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 691 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 692 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 693 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 694 | pub async fn notification_keywords(&self) -> Vec<String> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 695 | self.client |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 696 | .notification_settings() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 697 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 698 | .enabled_keywords() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 699 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 700 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 701 | .collect() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 702 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 703 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 704 | pub async fn resolve_push_notification( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 705 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 706 | room_id: &RoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 707 | event_id: &EventId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 708 | ) -> Result<PushNotificationStatus, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 709 | let notification_failed = |source| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 710 | Error::with_source( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 711 | ErrorKind::Other, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 712 | "resolving the push notification failed", |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 713 | source, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 714 | ) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 715 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 716 | let client = self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 717 | .notification_client |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 718 | .get_or_try_init(|| async { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 719 | NotificationClient::new( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 720 | self.client.clone(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 721 | NotificationProcessSetup::SingleProcess { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 722 | sync_service: self.sync_service.clone(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 723 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 724 | ) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 725 | .await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 726 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 727 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 728 | .map_err(notification_failed)?; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 729 | let status = client |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 730 | .get_notification(room_id, event_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 731 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 732 | .map_err(notification_failed)?; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 733 | Ok(normalise_push_notification(room_id, event_id, status)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 734 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 735 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 736 | pub async fn members( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 737 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 738 | room_id: &RoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 739 | filter: MemberFilter, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 740 | ) -> Result<Vec<MemberSummary>, Error> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 741 | let memberships = match filter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 742 | MemberFilter::Active => RoomMemberships::ACTIVE, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 743 | MemberFilter::Joined => RoomMemberships::JOIN, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 744 | MemberFilter::Invited => RoomMemberships::INVITE, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 745 | MemberFilter::Banned => RoomMemberships::BAN, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 746 | MemberFilter::Left => RoomMemberships::LEAVE, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 747 | // An empty mask is the SDK's unfiltered wildcard: it matches every |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 748 | // membership, including custom states that `all()` would exclude. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 749 | MemberFilter::All => RoomMemberships::empty(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 750 | }; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 751 | Ok(self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 752 | .room(room_id)? |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 753 | .members(memberships) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 754 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 755 | .map_err(|source| Error::from_sdk("listing members failed", source))? |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 756 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 757 | .map(member_summary) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 758 | .collect()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 759 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 760 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 761 | pub async fn room_power_levels(&self, room_id: &RoomId) -> Result<RoomPowerLevels, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 762 | let levels = self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 763 | .room(room_id)? |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 764 | .power_levels() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 765 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 766 | .map_err(|source| Error::from_sdk("reading power levels failed", source.into()))?; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 767 | Ok(RoomPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 768 | ban: levels.ban.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 769 | invite: levels.invite.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 770 | kick: levels.kick.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 771 | redact: levels.redact.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 772 | events_default: levels.events_default.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 773 | state_default: levels.state_default.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 774 | users_default: levels.users_default.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 775 | room_notification: levels.notifications.room.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 776 | users: levels |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 777 | .users |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 778 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 779 | .map(|(user_id, level)| (user_id, level.into())) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 780 | .collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 781 | events: levels |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 782 | .events |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 783 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 784 | .map(|(event_type, level)| (event_type.to_string(), level.into())) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 785 | .collect(), |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 786 | creators: levels |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 787 | .rules |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 788 | .privileged_creators |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 789 | .into_iter() |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 790 | .flatten() |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 791 | .collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 792 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 793 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 794 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 795 | pub async fn pending_send_ids( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 796 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 797 | room_id: &RoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 798 | ) -> Result<Vec<OwnedTransactionId>, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 799 | let (echoes, _) = self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 800 | .room(room_id)? |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 801 | .send_queue() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 802 | .subscribe() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 803 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 804 | .map_err(|source| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 805 | Error::with_source(ErrorKind::Store, "reading the send queue failed", source) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 806 | })?; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 807 | Ok(echoes |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 808 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 809 | .filter(|echo| { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 810 | matches!( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 811 | echo.content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 812 | matrix_sdk::send_queue::LocalEchoContent::Event { .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 813 | ) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 814 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 815 | .map(|echo| echo.transaction_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 816 | .collect()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 817 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 818 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 819 | pub async fn global_account_data( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 820 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 821 | event_type: GlobalAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 822 | ) -> Result<Option<Raw<AnyGlobalAccountDataEventContent>>, Error> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 823 | self.client |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 824 | .account() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 825 | .account_data_raw(event_type) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 826 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 827 | .map_err(|source| Error::from_sdk("reading account data failed", source)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 828 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 829 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 830 | pub async fn room_account_data( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 831 | &self, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 832 | room_id: &RoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 833 | event_type: RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 834 | ) -> Result<Option<Raw<AnyRoomAccountDataEvent>>, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 835 | self.room(room_id)? |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 836 | .account_data(event_type) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 837 | .await |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 838 | .map_err(|source| Error::from_sdk("reading room account data failed", source)) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 839 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 840 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 841 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 842 | pub fn connection_state(&self) -> watch::Receiver<ConnectionState> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 843 | self.connection.clone() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 844 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 845 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 846 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 847 | pub fn encryption_state(&self) -> Option<EncryptionState> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 848 | let device_id = self.client.device_id()?.to_owned(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 849 | let encryption = self.client.encryption(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 850 | Some(encryption_state( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 851 | device_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 852 | encryption.recovery().state(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 853 | encryption.verification_state().get(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 854 | encryption.backups().state(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 855 | )) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 856 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 857 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 858 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 859 | /// one space's hierarchy, a page at a time. hold on to it while you browse, it remembers where it got to |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 860 | pub struct SpaceHierarchy(SpaceRoomList); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 861 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 862 | impl fmt::Debug for SpaceHierarchy { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 863 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 864 | formatter |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 865 | .debug_struct("SpaceHierarchy") |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 866 | .finish_non_exhaustive() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 867 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 868 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 869 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 870 | impl SpaceHierarchy { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 871 | /// fetches the next page. a no-op once the end is reached or while a page is in flight |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 872 | pub async fn paginate(&self) -> Result<(), Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 873 | self.0.paginate().await.map_err(|source| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 874 | Error::with_source( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 875 | ErrorKind::Server, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 876 | "fetching the space hierarchy failed", |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 877 | source, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 878 | ) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 879 | }) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 880 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 881 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 882 | /// everything fetched so far, the space itself excluded |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 883 | pub async fn rooms(&self) -> Vec<SpaceChild> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 884 | self.0.rooms().await.into_iter().map(space_child).collect() |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 885 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 886 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 887 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 888 | pub fn end_reached(&self) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 889 | matches!( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 890 | self.0.pagination_state(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 891 | SpaceRoomListPaginationState::Idle { end_reached: true } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 892 | ) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 893 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 894 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 895 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 896 | fn profile( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 897 | user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 898 | response: &ruma::api::client::profile::get_profile::v3::Response, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 899 | ) -> Result<Profile, Error> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 900 | use ruma::api::client::profile::{AvatarUrl, DisplayName}; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 901 | let malformed = |source| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 902 | Error::with_source( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 903 | ErrorKind::Server, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 904 | "the server sent a malformed profile", |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 905 | source, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 906 | ) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 907 | }; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 908 | Ok(Profile { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 909 | user_id, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 910 | display_name: response.get_static::<DisplayName>().map_err(malformed)?, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 911 | avatar: response.get_static::<AvatarUrl>().map_err(malformed)?, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 912 | }) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 913 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 914 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 915 | #[derive(Debug)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 916 | pub(crate) struct Request { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 917 | pub(crate) command: Command, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 918 | pub(crate) reply: Responder, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 919 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 920 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 921 | impl Request { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 922 | fn new(command: Command) -> (Self, Pending) { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 923 | let (reply, pending) = oneshot::channel(); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 924 | ( |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 925 | Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 926 | command, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 927 | reply: Responder(reply), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 928 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 929 | Pending(pending), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 930 | ) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 931 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 932 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 933 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 934 | /// whoever holds this owes the caller an answer. dropping it answers `Interrupted` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 935 | #[derive(Debug)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 936 | pub(crate) struct Responder(oneshot::Sender<Result<CommandOutput, Error>>); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 937 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 938 | impl Responder { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 939 | pub(crate) fn send(self, result: Result<CommandOutput, Error>) { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 940 | if let Err(error) = &result { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 941 | tracing::debug!(%error, kind = ?error.kind, "command failed"); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 942 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 943 | let _ = self.0.send(result); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 944 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 945 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 946 | pub(crate) fn done(self, result: Result<(), Error>) { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 947 | self.send(result.map(|()| CommandOutput::Done)); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 948 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 949 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 950 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 951 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 952 | pub struct EventStream { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 953 | events: mpsc::Receiver<Event>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 954 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 955 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 956 | impl EventStream { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 957 | pub async fn recv(&mut self) -> Option<Event> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 958 | self.events.recv().await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 959 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 960 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 961 | pub fn try_recv(&mut self) -> Result<Event, mpsc::error::TryRecvError> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 962 | self.events.try_recv() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 963 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 964 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 965 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 966 | impl futures_util::Stream for EventStream { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 967 | type Item = Event; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 968 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 969 | fn poll_next(mut self: Pin<&mut Self>, context: &mut Context<'_>) -> Poll<Option<Self::Item>> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 970 | self.events.poll_recv(context) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 971 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 972 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 973 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 974 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 975 | pub(crate) struct DriverPort { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 976 | requests: mpsc::Receiver<Request>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 977 | events: mpsc::Sender<Event>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 978 | connection: watch::Sender<ConnectionState>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 979 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 980 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 981 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 982 | pub(crate) struct EventSender(mpsc::Sender<Event>); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 983 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 984 | impl EventSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 985 | pub(crate) async fn send(&self, event: Event) -> Result<(), SendEventError> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 986 | self.0.send(event).await.map_err(|_| SendEventError) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 987 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 988 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 989 | /// resolves once every `EventStream` is gone |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 990 | pub(crate) async fn closed(&self) { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 991 | self.0.closed().await; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 992 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 993 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 994 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 995 | impl DriverPort { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 996 | pub(crate) fn event_sender(&self) -> EventSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 997 | EventSender(self.events.clone()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 998 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 999 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1000 | pub(crate) fn connection_sender(&self) -> watch::Sender<ConnectionState> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1001 | self.connection.clone() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1002 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1003 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1004 | pub(crate) async fn recv(&mut self) -> Option<Request> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1005 | self.requests.recv().await |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1006 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1007 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1008 | pub(crate) fn try_recv(&mut self) -> Option<Request> { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1009 | self.requests.try_recv().ok() |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1010 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1011 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1012 | pub(crate) fn close(&mut self) { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1013 | self.requests.close(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1014 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1015 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1016 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1017 | #[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1018 | #[error("the event receiver has closed")] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1019 | pub(crate) struct SendEventError; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1020 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1021 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1022 | pub(crate) fn transport_pair( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1023 | client: Client, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1024 | sync_service: Arc<SyncService>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1025 | media: Arc<MediaService>, |
a250c7fa43fb | atagen | 2026-09-26 13:35 UTC | 1026 | store_lock: Option<Arc<StoreLock>>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1027 | command_capacity: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1028 | event_capacity: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1029 | ) -> (ClientHandle, DriverPort, EventStream) { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1030 | let (request_tx, request_rx) = mpsc::channel(command_capacity); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1031 | let (event_tx, event_rx) = mpsc::channel(event_capacity); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1032 | let (connection_tx, connection_rx) = watch::channel(ConnectionState::Idle); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1033 | ( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1034 | ClientHandle { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1035 | requests: request_tx, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1036 | client, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1037 | connection: connection_rx, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1038 | notification_client: Arc::new(OnceCell::new()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1039 | sync_service, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1040 | media, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1041 | spaces: Arc::new(OnceCell::new()), |
a250c7fa43fb | atagen | 2026-09-26 13:35 UTC | 1042 | _store_lock: store_lock, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1043 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1044 | DriverPort { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1045 | requests: request_rx, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1046 | events: event_tx, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1047 | connection: connection_tx, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1048 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1049 | EventStream { events: event_rx }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1050 | ) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1051 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1052 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1053 | fn normalise_push_notification( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1054 | room_id: &RoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1055 | event_id: &EventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1056 | status: NotificationStatus, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1057 | ) -> PushNotificationStatus { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1058 | match status { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1059 | NotificationStatus::Event(item) => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1060 | let event = match &item.raw_event { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1061 | RawNotificationEvent::Timeline(event) => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1062 | PushNotificationEvent::Timeline(event.clone()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1063 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1064 | RawNotificationEvent::Invite(event) => PushNotificationEvent::Invite(event.clone()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1065 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1066 | PushNotificationStatus::Event(Box::new(PushNotification { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1067 | event_id: event_id.to_owned(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1068 | event, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1069 | sender: PushNotificationSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1070 | user_id: item.event.sender().to_owned(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1071 | display_name: item.sender_display_name, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1072 | avatar_url: item.sender_avatar_url.map(Into::into), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1073 | name_ambiguous: item.is_sender_name_ambiguous, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1074 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1075 | room: PushNotificationRoom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1076 | room_id: room_id.to_owned(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1077 | name: item.room_computed_display_name, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1078 | avatar_url: item.room_avatar_url.map(Into::into), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1079 | canonical_alias: item |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1080 | .room_canonical_alias |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1081 | .as_deref() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1082 | .and_then(|alias| alias.parse().ok()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1083 | topic: item.room_topic, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1084 | encrypted: item.is_room_encrypted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1085 | direct: item.room_is_dm, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1086 | joined_members_count: item.joined_members_count, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1087 | service_members: item |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1088 | .service_members |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1089 | .into_iter() |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1090 | .filter_map(|user_id| user_id.parse().ok()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1091 | .collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1092 | active_service_members_count: item.active_service_members_count, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1093 | space: item.is_space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1094 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1095 | noisy: item.is_noisy, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1096 | has_mention: item.has_mention, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1097 | thread_id: item.thread_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1098 | })) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1099 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1100 | NotificationStatus::EventNotFound => PushNotificationStatus::NotFound, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1101 | NotificationStatus::EventFilteredOut => PushNotificationStatus::FilteredOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1102 | NotificationStatus::EventRedacted => PushNotificationStatus::Redacted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1103 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1104 | } |