96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1 | use std::{fmt, sync::Arc}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 3 | use ruma::{ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 4 | OwnedDeviceId, OwnedEventId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 5 | OwnedServerName, OwnedTransactionId, OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 6 | events::{ |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 7 | AnyGlobalAccountDataEventContent, AnyRoomAccountDataEventContent, AnySyncTimelineEvent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 8 | GlobalAccountDataEventType, RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 9 | room::member::StrippedRoomMemberEvent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 10 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 11 | serde::Raw, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 12 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 13 | #[cfg(feature = "serde")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 14 | use serde::{Deserialize, Serialize}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 15 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 16 | /// every command answers exactly once through `ClientHandle::send` or `execute`. |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 17 | /// the event stream only ever carries state |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 18 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 19 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 20 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 21 | pub enum Command { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 22 | Account(AccountCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 23 | Room(RoomCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 24 | Timeline(TimelineCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 25 | Media(MediaCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 26 | Encryption(EncryptionCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 27 | Notification(NotificationCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 28 | Lifecycle(LifecycleCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 29 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 30 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 31 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 32 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 33 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 34 | pub enum AccountCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 35 | Logout, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 36 | SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 37 | event_type: GlobalAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 38 | content: Raw<AnyGlobalAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 39 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 40 | SetDisplayName(Option<String>), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 41 | SetAvatar(Option<OwnedMxcUri>), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 42 | /// uploads the image and points the profile at it, same byte cap as any upload |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 43 | UploadAvatar { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 44 | mimetype: String, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 45 | bytes: Vec<u8>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 46 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 47 | RenameDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 48 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 49 | display_name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 50 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 51 | DeleteDevices { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 52 | device_ids: Vec<OwnedDeviceId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 53 | auth: Option<crate::InteractiveAuth>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 54 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 55 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 56 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 57 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 58 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 59 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 60 | pub enum RoomCommand { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 61 | /// the snapshot turns up as `Event::TimelineReset`. opening an open room sends a fresh one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 62 | Open(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 63 | Close(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 64 | Join { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 65 | room: OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 66 | via: Vec<OwnedServerName>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 67 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 68 | Leave(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 69 | Forget(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 70 | AcceptInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 71 | RejectInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 72 | InviteUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 73 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 74 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 75 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 76 | KickUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 77 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 78 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 79 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 80 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 81 | BanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 82 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 83 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 84 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 85 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 86 | UnbanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 87 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 88 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 89 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 90 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 91 | SetPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 92 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 93 | changes: PowerLevelChanges, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 94 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 95 | SetUserPowerLevel { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 96 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 97 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 98 | level: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 99 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 100 | Create(CreateRoomOptions), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 101 | /// hands back the existing dm if there is one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 102 | CreateDirect(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 103 | CancelSend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 104 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 105 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 106 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 107 | RetrySend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 108 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 109 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 110 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 111 | SetTyping { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 112 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 113 | typing: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 114 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 115 | SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 116 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 117 | event_type: RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 118 | content: Raw<AnyRoomAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 119 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 120 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 121 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 122 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 123 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 124 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 125 | pub struct CreateRoomOptions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 126 | pub name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 127 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 128 | pub alias_localpart: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 129 | pub invite: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 130 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 131 | pub visibility: RoomVisibility, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 132 | pub preset: Option<RoomPreset>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 133 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 134 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 135 | impl CreateRoomOptions { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 136 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 137 | pub fn with_name(mut self, name: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 138 | self.name = Some(name.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 139 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 140 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 141 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 142 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 143 | pub fn with_topic(mut self, topic: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 144 | self.topic = Some(topic.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 145 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 146 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 147 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 148 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 149 | pub fn with_alias_localpart(mut self, localpart: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 150 | self.alias_localpart = Some(localpart.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 151 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 152 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 153 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 154 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 155 | pub fn with_invite(mut self, invite: impl IntoIterator<Item = OwnedUserId>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 156 | self.invite = invite.into_iter().collect(); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 157 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 158 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 159 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 160 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 161 | pub const fn with_direct(mut self, direct: bool) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 162 | self.direct = direct; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 163 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 164 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 165 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 166 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 167 | pub const fn with_visibility(mut self, visibility: RoomVisibility) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 168 | self.visibility = visibility; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 169 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 170 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 171 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 172 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 173 | pub const fn with_preset(mut self, preset: RoomPreset) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 174 | self.preset = Some(preset); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 175 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 176 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 177 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 178 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 179 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 180 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 181 | pub enum RoomVisibility { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 182 | #[default] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 183 | Private, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 184 | Public, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 185 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 186 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 187 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 188 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 189 | pub enum RoomPreset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 190 | PrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 191 | TrustedPrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 192 | PublicChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 193 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 194 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 195 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 196 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 197 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 198 | pub enum TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 199 | OpenThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 200 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 201 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 202 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 203 | CloseThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 204 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 205 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 206 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 207 | /// Re-emit an authoritative reset for an open room or thread without |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 208 | /// closing it. The reset arrives before this command's terminal result. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 209 | Resync { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 210 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 211 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 212 | Paginate { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 213 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 214 | limit: u16, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 215 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 216 | Send { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 217 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 218 | content: MessageContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 219 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 220 | Edit { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 221 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 222 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 223 | content: MessageEditContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 224 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 225 | Redact { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 226 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 227 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 228 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 229 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 230 | ToggleReaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 231 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 232 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 233 | key: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 234 | }, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 235 | /// works on a closed room too, it just can't refuse to move the marker backwards |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 236 | MarkRead { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 237 | timeline_id: TimelineId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 238 | event_id: OwnedEventId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 239 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 240 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 241 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 242 | impl TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 243 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 244 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 245 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 246 | Self::OpenThread { room_id, .. } | Self::CloseThread { room_id, .. } => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 247 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 248 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 249 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 250 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 251 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 252 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 253 | | Self::MarkRead { timeline_id, .. } => timeline_id.room_id(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 254 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 255 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 256 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 257 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 258 | pub const fn timeline_id(&self) -> Option<&TimelineId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 259 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 260 | Self::OpenThread { .. } | Self::CloseThread { .. } => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 261 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 262 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 263 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 264 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 265 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 266 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 267 | | Self::MarkRead { timeline_id, .. } => Some(timeline_id), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 268 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 269 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 270 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 271 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 272 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 273 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 274 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 275 | pub enum TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 276 | Room(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 277 | Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 278 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 279 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 280 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 281 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 282 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 283 | impl TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 284 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 285 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 286 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 287 | Self::Room(room_id) | Self::Thread { room_id, .. } => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 288 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 289 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 290 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 291 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 292 | pub fn thread(room_id: OwnedRoomId, root_event_id: OwnedEventId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 293 | Self::Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 294 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 295 | root_event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 296 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 297 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 298 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 299 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 300 | pub fn thread_root(&self) -> Option<&OwnedEventId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 301 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 302 | Self::Room(_) => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 303 | Self::Thread { root_event_id, .. } => Some(root_event_id), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 304 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 305 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 306 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 307 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 308 | impl From<OwnedRoomId> for TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 309 | fn from(room_id: OwnedRoomId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 310 | Self::Room(room_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 311 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 312 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 313 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 314 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 315 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 316 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 317 | pub enum MediaCommand { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 318 | /// succeeds once the send queue has it. progress and failure arrive as events |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 319 | Upload(AttachmentUpload), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 320 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 321 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 322 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 323 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 324 | pub struct AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 325 | pub timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 326 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 327 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 328 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 329 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 330 | pub details: Option<UploadDetails>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 331 | pub thumbnail: Option<UploadThumbnail>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 332 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 333 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 334 | impl AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 335 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 336 | pub fn new( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 337 | timeline_id: impl Into<TimelineId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 338 | filename: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 339 | mimetype: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 340 | bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 341 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 342 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 343 | timeline_id: timeline_id.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 344 | filename: filename.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 345 | mimetype: mimetype.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 346 | bytes, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 347 | caption: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 348 | details: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 349 | thumbnail: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 350 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 351 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 352 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 353 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 354 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 355 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 356 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 357 | pub enum UploadDetails { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 358 | Image { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 359 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 360 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 361 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 362 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 363 | Video { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 364 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 365 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 366 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 367 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 368 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 369 | Audio { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 370 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 371 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 372 | Voice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 373 | duration_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 374 | waveform: Vec<u16>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 375 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 376 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 377 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 378 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 379 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 380 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 381 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 382 | pub struct UploadThumbnail { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 383 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 384 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 385 | pub width: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 386 | pub height: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 387 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 388 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 389 | impl UploadThumbnail { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 390 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 391 | pub fn new(bytes: Vec<u8>, mimetype: impl Into<String>, width: u32, height: u32) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 392 | Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 393 | bytes, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 394 | mimetype: mimetype.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 395 | width, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 396 | height, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 397 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 398 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 399 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 400 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 401 | #[derive(Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 402 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 403 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 404 | pub enum EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 405 | Recover(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 406 | CreateKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 407 | EnableKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 408 | DisableKeyBackup { delete_from_server: bool }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 409 | RecoverKeyBackup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 410 | StartVerification(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 411 | Verify(VerificationAction), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 412 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 413 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 414 | impl fmt::Debug for EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 415 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 416 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 417 | Self::Recover(_) => formatter.debug_tuple("Recover").field(&"...").finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 418 | Self::CreateKeyBackup => formatter.write_str("CreateKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 419 | Self::EnableKeyBackup => formatter.write_str("EnableKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 420 | Self::DisableKeyBackup { delete_from_server } => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 421 | .debug_struct("DisableKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 422 | .field("delete_from_server", delete_from_server) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 423 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 424 | Self::RecoverKeyBackup(_) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 425 | .debug_tuple("RecoverKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 426 | .field(&"...") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 427 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 428 | Self::StartVerification(target) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 429 | .debug_tuple("StartVerification") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 430 | .field(target) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 431 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 432 | Self::Verify(action) => formatter.debug_tuple("Verify").field(action).finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 433 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 434 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 435 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 436 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 437 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 438 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 439 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 440 | pub enum NotificationCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 441 | SetRoomMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 442 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 443 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 444 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 445 | ResetRoomMode(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 446 | SetDefaultMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 447 | encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 448 | one_to_one: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 449 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 450 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 451 | AddKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 452 | RemoveKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 453 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 454 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 455 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 456 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 457 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 458 | pub enum LifecycleCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 459 | Shutdown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 460 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 461 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 462 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 463 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 464 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 465 | pub enum CommandOutput { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 466 | Done, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 467 | Room(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 468 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 469 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 470 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 471 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 472 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 473 | pub enum MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 474 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 475 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 476 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 477 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 478 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 479 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 480 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 481 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 482 | Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 483 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 484 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 485 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 486 | notify_replied_to: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 487 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 488 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 489 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 490 | impl MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 491 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 492 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 493 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 494 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 495 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 496 | } |
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 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 500 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 501 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 502 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 503 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 504 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 505 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 506 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 507 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 508 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 509 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 510 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 511 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 512 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 513 | pub fn reply(event_id: OwnedEventId, content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 514 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 515 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 516 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 517 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 518 | notify_replied_to: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 519 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 520 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 521 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 522 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 523 | pub fn reply_without_notification( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 524 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 525 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 526 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 527 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 528 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 529 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 530 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 531 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 532 | notify_replied_to: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 533 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 534 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 535 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 536 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 537 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 538 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 539 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 540 | pub enum MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 541 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 542 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 543 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 544 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 545 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 546 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 547 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 548 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 549 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 550 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 551 | impl MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 552 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 553 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 554 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 555 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 556 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 557 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 558 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 559 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 560 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 561 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 562 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 563 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 564 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 565 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 566 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 567 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 568 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 569 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 570 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 571 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 572 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 573 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 574 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 575 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 576 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 577 | pub struct RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 578 | pub body: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 579 | pub formatted_body: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 580 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 581 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 582 | impl RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 583 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 584 | pub fn plain(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 585 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 586 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 587 | formatted_body: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 588 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 589 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 590 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 591 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 592 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 593 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 594 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 595 | formatted_body: Some(formatted_body.into()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 596 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 597 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 598 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 599 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 600 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 601 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 602 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 603 | pub struct MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 604 | pub user_ids: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 605 | pub room: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 606 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 607 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 608 | impl MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 609 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 610 | pub fn with_user_ids(user_ids: impl IntoIterator<Item = OwnedUserId>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 611 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 612 | user_ids: user_ids.into_iter().collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 613 | room: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 614 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 615 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 616 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 617 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 618 | pub fn room() -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 619 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 620 | user_ids: Vec::new(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 621 | room: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 622 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 623 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 624 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 625 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 626 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 627 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 628 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 629 | pub enum Event { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 630 | ConnectionChanged(ConnectionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 631 | Authenticated { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 632 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 633 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 634 | /// Refresh tokens changed. Persist a fresh `ClientHandle::session_record()` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 635 | /// atomically; a record captured before this event may no longer restore. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 636 | SessionTokensChanged, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 637 | /// the server stopped honouring our token and the engine stops. on a soft |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 638 | /// logout keep the store and log in again with the same device, otherwise |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 639 | /// the record and the store are both dead |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 640 | SessionAccessRejected { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 641 | soft_logout: bool, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 642 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 643 | NotificationSettingsChanged, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 644 | VerificationTargetChanged(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 645 | RoomsChanged, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 646 | /// replaces whatever you had for this timeline. every diff after it applies to it |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 647 | TimelineReset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 648 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 649 | items: Vec<TimelineItem>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 650 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 651 | TimelineChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 652 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 653 | diffs: Vec<TimelineDiff>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 654 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 655 | HistoryChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 656 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 657 | state: HistoryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 658 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 659 | TypingChanged(TypingState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 660 | MediaUploadProgress { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 661 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 662 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 663 | uploaded_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 664 | total_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 665 | complete: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 666 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 667 | MediaUploadFailed { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 668 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 669 | transaction_id: OwnedTransactionId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 670 | kind: crate::ErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 671 | recoverable: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 672 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 673 | EncryptionChanged(EncryptionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 674 | VerificationChanged(VerificationState), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 675 | /// logout went through and the engine stops. delete the record and the store |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 676 | LoggedOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 677 | Failed(EngineFailure), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 678 | /// always the last event. keep the saved record unless `LoggedOut` or a |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 679 | /// hard `SessionAccessRejected` came first. commands still in flight get no result |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 680 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 681 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 682 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 683 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 684 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 685 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 686 | pub enum ConnectionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 687 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 688 | Connecting, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 689 | Online, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 690 | Offline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 691 | Stopped, |
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 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 695 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 696 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 697 | pub struct RoomSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 698 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 699 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 700 | pub membership: RoomMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 701 | pub unread_messages: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 702 | pub unread_mentions: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 703 | pub encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 704 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 705 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 706 | pub favourite: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 707 | pub low_priority: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 708 | pub avatar: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 709 | pub latest_event_timestamp_ms: Option<u64>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 710 | pub latest_event: Option<LatestEvent>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 711 | pub notification_mode: Option<RoomNotificationMode>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 712 | pub notification_mode_custom: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 713 | pub topic: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 714 | pub canonical_alias: Option<OwnedRoomAliasId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 715 | pub joined_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 716 | pub invited_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 717 | /// who a nameless room gets named after |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 718 | pub heroes: Vec<RoomHero>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 719 | /// set once the room has been upgraded, this is where everyone went |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 720 | pub successor: Option<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 721 | pub inviter: Option<OwnedUserId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 722 | /// joined spaces that list this room as a child |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 723 | pub parent_spaces: Vec<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 724 | /// for a space, the children it lists, joined or not |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 725 | pub children: Vec<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 726 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 727 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 728 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 729 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 730 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 731 | pub struct RoomHero { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 732 | pub user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 733 | pub display_name: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 734 | pub avatar: Option<OwnedMxcUri>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 735 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 736 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 737 | /// enough for a room list preview line. `body` is empty for anything that isn't a plain message |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 738 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 739 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 740 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 741 | pub struct LatestEvent { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 742 | pub sender: Option<OwnedUserId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 743 | pub body: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 744 | pub timestamp_ms: Option<u64>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 745 | pub send_state: SendState, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 746 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 747 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 748 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 749 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 750 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 751 | pub struct Profile { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 752 | pub user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 753 | pub display_name: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 754 | pub avatar: Option<OwnedMxcUri>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 755 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 756 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 757 | /// one room in a space's hierarchy, as the server describes it, which may be a room you're not in |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 758 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 759 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 760 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 761 | pub struct SpaceChild { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 762 | pub room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 763 | pub name: String, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 764 | pub topic: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 765 | pub avatar: Option<OwnedMxcUri>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 766 | pub canonical_alias: Option<OwnedRoomAliasId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 767 | pub joined_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 768 | pub space: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 769 | pub children_count: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 770 | pub membership: Option<RoomMembership>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 771 | pub via: Vec<OwnedServerName>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 772 | pub suggested: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 773 | pub world_readable: Option<bool>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 774 | pub guest_can_join: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 775 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 776 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 777 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 778 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 779 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 780 | pub enum RoomNotificationMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 781 | AllMessages, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 782 | MentionsAndKeywordsOnly, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 783 | Mute, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 784 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 785 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 786 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 787 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 788 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 789 | pub struct RoomNotificationSettings { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 790 | pub mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 791 | pub custom: bool, |
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 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 795 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 796 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 797 | pub enum PushNotificationStatus { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 798 | Event(Box<PushNotification>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 799 | NotFound, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 800 | FilteredOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 801 | Redacted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 802 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 803 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 804 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 805 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 806 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 807 | pub struct PushNotification { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 808 | pub event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 809 | pub event: PushNotificationEvent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 810 | pub sender: PushNotificationSender, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 811 | pub room: PushNotificationRoom, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 812 | pub noisy: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 813 | pub has_mention: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 814 | pub thread_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 815 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 816 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 817 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 818 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 819 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 820 | pub struct PushNotificationSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 821 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 822 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 823 | pub avatar_url: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 824 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 825 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 826 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 827 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 828 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 829 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 830 | pub struct PushNotificationRoom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 831 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 832 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 833 | pub avatar_url: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 834 | pub canonical_alias: Option<OwnedRoomAliasId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 835 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 836 | pub encrypted: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 837 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 838 | pub joined_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 839 | pub service_members: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 840 | pub active_service_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 841 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 842 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 843 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 844 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 845 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 846 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 847 | pub enum PushNotificationEvent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 848 | Timeline(Raw<AnySyncTimelineEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 849 | Invite(Raw<StrippedRoomMemberEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 850 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 851 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 852 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 853 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 854 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 855 | pub struct RoomPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 856 | pub ban: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 857 | pub invite: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 858 | pub kick: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 859 | pub redact: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 860 | pub events_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 861 | pub state_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 862 | pub users_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 863 | pub room_notification: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 864 | pub users: Vec<(OwnedUserId, i64)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 865 | pub events: Vec<(String, i64)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 866 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 867 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 868 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 869 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 870 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 871 | pub struct PowerLevelChanges { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 872 | pub ban: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 873 | pub invite: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 874 | pub kick: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 875 | pub redact: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 876 | pub events_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 877 | pub state_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 878 | pub users_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 879 | pub room_notification: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 880 | pub room_name: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 881 | pub room_avatar: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 882 | pub room_topic: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 883 | pub space_child: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 884 | pub beacon: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 885 | pub beacon_info: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 886 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 887 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 888 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 889 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 890 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 891 | pub enum RoomMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 892 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 893 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 894 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 895 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 896 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 897 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 898 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 899 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 900 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 901 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 902 | pub struct RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 903 | pub membership: Option<RoomMembership>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 904 | pub category: Option<RoomCategory>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 905 | pub favourite: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 906 | pub unread_only: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 907 | pub search: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 908 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 909 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 910 | impl RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 911 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 912 | pub fn with_membership(mut self, membership: RoomMembership) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 913 | self.membership = Some(membership); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 914 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 915 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 916 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 917 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 918 | pub fn with_category(mut self, category: RoomCategory) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 919 | self.category = Some(category); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 920 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 921 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 922 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 923 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 924 | pub fn with_favourite(mut self, favourite: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 925 | self.favourite = Some(favourite); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 926 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 927 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 928 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 929 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 930 | pub const fn with_unread_only(mut self, unread_only: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 931 | self.unread_only = unread_only; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 932 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 933 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 934 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 935 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 936 | pub fn with_search(mut self, search: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 937 | self.search = Some(search.into()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 938 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 939 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 940 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 941 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 942 | pub fn matches(&self, room: &RoomSummary) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 943 | self.matcher().matches(room) |
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 | /// lowercases the search once, for filtering a whole list |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 947 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 948 | pub fn matcher(&self) -> RoomMatcher<'_> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 949 | RoomMatcher { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 950 | filter: self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 951 | search: self.search.as_deref().map(str::to_lowercase), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 952 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 953 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 954 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 955 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 956 | #[derive(Debug)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 957 | pub struct RoomMatcher<'a> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 958 | filter: &'a RoomListFilter, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 959 | search: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 960 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 961 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 962 | impl RoomMatcher<'_> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 963 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 964 | pub fn matches(&self, room: &RoomSummary) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 965 | let filter = self.filter; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 966 | filter |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 967 | .membership |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 968 | .is_none_or(|membership| room.membership == membership) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 969 | && filter.category.is_none_or(|category| match category { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 970 | RoomCategory::People => room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 971 | RoomCategory::Rooms => !room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 972 | RoomCategory::Spaces => room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 973 | }) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 974 | && filter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 975 | .favourite |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 976 | .is_none_or(|favourite| room.favourite == favourite) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 977 | && (!filter.unread_only || room.unread_messages > 0 || room.unread_mentions > 0) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 978 | && self.search.as_ref().is_none_or(|search| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 979 | room.name.to_lowercase().contains(search) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 980 | || room.room_id.as_str().to_lowercase().contains(search) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 981 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 982 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 983 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 984 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 985 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 986 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 987 | pub enum RoomCategory { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 988 | People, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 989 | Rooms, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 990 | Spaces, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 991 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 992 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 993 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 994 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 995 | pub enum MemberFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 996 | Active, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 997 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 998 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 999 | All, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1000 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1001 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1002 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1003 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1004 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1005 | pub enum MemberMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1006 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1007 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1008 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1009 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1010 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1011 | Custom(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1012 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1013 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1014 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1015 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1016 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1017 | pub struct MemberSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1018 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1019 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1020 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1021 | pub avatar: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1022 | pub membership: MemberMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1023 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1024 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1025 | pub ignored: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1026 | pub service: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1027 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1028 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1029 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1030 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1031 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1032 | pub struct OwnDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1033 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1034 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1035 | pub last_seen_ip: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1036 | pub last_seen_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1037 | pub current: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1038 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1039 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1040 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1041 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1042 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1043 | pub enum TimelineItem { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1044 | Message(Box<TimelineMessage>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1045 | DayDivider { timestamp_ms: u64 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1046 | ReadMarker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1047 | TimelineStart, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1048 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1049 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1050 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1051 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1052 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1053 | pub enum TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1054 | Append { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1055 | Clear, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1056 | PushFront { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1057 | PushBack { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1058 | PopFront, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1059 | PopBack, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1060 | Insert { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1061 | Set { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1062 | Remove { index: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1063 | Truncate { length: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1064 | Reset { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1065 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1066 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1067 | #[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1068 | #[error("timeline diff is incompatible with the current {length}-item snapshot")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1069 | pub struct TimelineDiffError { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1070 | pub length: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1071 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1072 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1073 | impl TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1074 | /// Apply a diff only when its indices match the current snapshot. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1075 | /// On error the snapshot is unchanged; request `TimelineCommand::Resync` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1076 | /// and ignore further diffs until the corresponding `TimelineReset`. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1077 | pub fn try_apply(self, items: &mut Vec<TimelineItem>) -> Result<(), TimelineDiffError> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1078 | let length = items.len(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1079 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1080 | Self::Append { values } => items.extend(values), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1081 | Self::Clear => items.clear(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1082 | Self::PushFront { value } => items.insert(0, value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1083 | Self::PushBack { value } => items.push(value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1084 | Self::PopFront if length == 0 => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1085 | Self::PopFront => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1086 | items.remove(0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1087 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1088 | Self::PopBack if length == 0 => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1089 | Self::PopBack => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1090 | items.pop(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1091 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1092 | Self::Insert { index, .. } if index > length => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1093 | return Err(TimelineDiffError { length }); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1094 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1095 | Self::Insert { index, value } => items.insert(index, value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1096 | Self::Set { index, .. } if index >= length => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1097 | Self::Set { index, value } => items[index] = value, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1098 | Self::Remove { index } if index >= length => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1099 | Self::Remove { index } => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1100 | items.remove(index); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1101 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1102 | Self::Truncate { length: target } if target > length => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1103 | return Err(TimelineDiffError { length }); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1104 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1105 | Self::Truncate { length } => items.truncate(length), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1106 | Self::Reset { values } => *items = values, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1107 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1108 | Ok(()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1109 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1110 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1111 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1112 | #[cfg(test)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1113 | mod tests { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1114 | use super::{TimelineDiff, TimelineItem}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1115 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1116 | fn item(timestamp_ms: u64) -> TimelineItem { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1117 | TimelineItem::DayDivider { timestamp_ms } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1118 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1119 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1120 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1121 | fn timeline_diff_try_apply_handles_every_variant() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1122 | let mut items = vec![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1123 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1124 | TimelineDiff::Append { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1125 | values: vec![item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1126 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1127 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1128 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1129 | assert_eq!(items, vec![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1130 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1131 | TimelineDiff::Clear.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1132 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1133 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1134 | TimelineDiff::PushFront { value: item(2) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1135 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1136 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1137 | TimelineDiff::PushBack { value: item(3) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1138 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1139 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1140 | assert_eq!(items, vec![item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1141 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1142 | TimelineDiff::PopFront.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1143 | TimelineDiff::PopBack.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1144 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1145 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1146 | TimelineDiff::Reset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1147 | values: vec![item(1), item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1148 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1149 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1150 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1151 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1152 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1153 | value: item(2), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1154 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1155 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1156 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1157 | assert_eq!(items, vec![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1158 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1159 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1160 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1161 | value: item(4), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1162 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1163 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1164 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1165 | assert_eq!(items, vec![item(1), item(4), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1166 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1167 | TimelineDiff::Remove { index: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1168 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1169 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1170 | assert_eq!(items, vec![item(1), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1171 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1172 | TimelineDiff::Truncate { length: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1173 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1174 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1175 | assert_eq!(items, vec![item(1)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1176 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1177 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1178 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1179 | fn invalid_timeline_diff_leaves_snapshot_unchanged() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1180 | let invalid = [ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1181 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1182 | index: 3, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1183 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1184 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1185 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1186 | index: 2, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1187 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1188 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1189 | TimelineDiff::Remove { index: 2 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1190 | TimelineDiff::Truncate { length: 3 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1191 | ]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1192 | for diff in invalid { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1193 | let mut items = vec![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1194 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 2); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1195 | assert_eq!(items, vec![item(1), item(2)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1196 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1197 | for diff in [TimelineDiff::PopFront, TimelineDiff::PopBack] { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1198 | let mut items = Vec::new(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1199 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1200 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1201 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1202 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1203 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1204 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1205 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1206 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1207 | pub struct TimelineItemId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1208 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1209 | impl TimelineItemId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1210 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1211 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1212 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1213 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1214 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1215 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1216 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1217 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1218 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1219 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1220 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1221 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1222 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1223 | pub struct TimelineMessage { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1224 | pub item_id: TimelineItemId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1225 | pub event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1226 | pub transaction_id: Option<OwnedTransactionId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1227 | pub sender_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1228 | pub sender_name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1229 | pub body: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1230 | pub formatted_body: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1231 | pub mentions: Option<MessageMentions>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1232 | pub thread_root: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1233 | pub thread_summary: Option<ThreadSummary>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1234 | pub timestamp_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1235 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1236 | pub send_state: SendState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1237 | pub edited: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1238 | pub unable_to_decrypt: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1239 | pub media: Option<MediaDescriptor>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1240 | pub reply_to: Option<ReplyReference>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1241 | pub reactions: Vec<Reaction>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1242 | pub read_by: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1243 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1244 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1245 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1246 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1247 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1248 | pub struct ThreadSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1249 | pub reply_count: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1250 | pub latest_event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1251 | pub latest_event_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1252 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1253 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1254 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1255 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1256 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1257 | pub enum SendState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1258 | Sent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1259 | Queued, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1260 | Sending, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1261 | Failed { retriable: bool }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1262 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1263 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1264 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1265 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1266 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1267 | pub struct ReplyReference { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1268 | pub event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1269 | pub sender_id: Option<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1270 | pub sender_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1271 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1272 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1273 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1274 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1275 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1276 | pub struct Reaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1277 | pub key: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1278 | pub count: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1279 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1280 | pub senders: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1281 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1282 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1283 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1284 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1285 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1286 | pub struct MediaDescriptor { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1287 | pub id: MediaId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1288 | pub kind: MediaKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1289 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1290 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1291 | pub mimetype: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1292 | pub size_bytes: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1293 | pub width: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1294 | pub height: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1295 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1296 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1297 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1298 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1299 | pub struct MediaId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1300 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1301 | impl MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1302 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1303 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1304 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1305 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1306 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1307 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1308 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1309 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1310 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1311 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1312 | impl std::fmt::Display for MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1313 | fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1314 | self.0.fmt(formatter) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1315 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1316 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1317 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1318 | #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1319 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1320 | pub enum MediaSize { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1321 | Full, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1322 | /// a hint. an uploader's own thumbnail wins over the server resizing anything |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1323 | Thumbnail { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1324 | width: u32, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1325 | height: u32, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1326 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1327 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1328 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1329 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1330 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1331 | pub struct Media { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1332 | pub bytes: Arc<[u8]>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1333 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1334 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1335 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1336 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1337 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1338 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1339 | pub enum MediaKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1340 | Image, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1341 | Video, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1342 | Audio, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1343 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1344 | Sticker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1345 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1346 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1347 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1348 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1349 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1350 | pub struct TypingState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1351 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1352 | pub users: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1353 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1354 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1355 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1356 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1357 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1358 | pub enum HistoryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1359 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1360 | Loading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1361 | StartReached, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1362 | Failed(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1363 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1364 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1365 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1366 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1367 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1368 | pub struct EncryptionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1369 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1370 | pub device_verified: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1371 | pub recovery: RecoveryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1372 | pub key_backup: KeyBackupState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1373 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1374 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1375 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1376 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1377 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1378 | pub enum KeyBackupState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1379 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1380 | Creating, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1381 | Enabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1382 | Resuming, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1383 | Downloading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1384 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1385 | Disabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1386 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1387 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1388 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1389 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1390 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1391 | pub enum RecoveryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1392 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1393 | Disabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1394 | Incomplete, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1395 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1396 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1397 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1398 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1399 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1400 | pub enum VerificationAction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1401 | Confirm, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1402 | Reject, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1403 | Cancel, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1404 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1405 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1406 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1407 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1408 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1409 | pub enum VerificationTarget { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1410 | OwnIdentity, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1411 | User(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1412 | Device { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1413 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1414 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1415 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1416 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1417 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1418 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1419 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1420 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1421 | pub enum VerificationState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1422 | Waiting, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1423 | Comparison { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1424 | emojis: Vec<(String, String)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1425 | decimals: (u16, u16, u16), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1426 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1427 | Confirmed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1428 | Done, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1429 | Cancelled(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1430 | Failed(VerificationFailure), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1431 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1432 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1433 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1434 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1435 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1436 | pub enum VerificationFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1437 | RequestAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1438 | SasStartup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1439 | SasAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1440 | RequestStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1441 | SasStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1442 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1443 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1444 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1445 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1446 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1447 | pub struct EngineFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1448 | pub kind: EngineErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1449 | pub message: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1450 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1451 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1452 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1453 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1454 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1455 | pub enum EngineErrorKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1456 | EventReceiverClosed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1457 | Watcher, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1458 | Other, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1459 | } |