96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1 | use std::{fmt, sync::Arc}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 3 | use imbl::Vector; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 4 | use ruma::{ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 5 | OwnedDeviceId, OwnedEventId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 6 | OwnedServerName, OwnedTransactionId, OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 7 | events::{ |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 8 | AnyGlobalAccountDataEventContent, AnyRoomAccountDataEventContent, AnySyncTimelineEvent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 9 | GlobalAccountDataEventType, RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 10 | room::member::StrippedRoomMemberEvent, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 11 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 12 | serde::Raw, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 13 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 14 | #[cfg(feature = "serde")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 15 | use serde::{Deserialize, Serialize}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 16 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 17 | /// every command answers exactly once through `ClientHandle::send` or `execute`. |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 18 | /// the event stream only ever carries state |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 19 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 20 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 21 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 22 | pub enum Command { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 23 | Account(AccountCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 24 | Room(RoomCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 25 | Timeline(TimelineCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 26 | Media(MediaCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 27 | Encryption(EncryptionCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 28 | Notification(NotificationCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 29 | Lifecycle(LifecycleCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 30 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 31 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 32 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 33 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 34 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 35 | pub enum AccountCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 36 | Logout, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 37 | SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 38 | event_type: GlobalAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 39 | content: Raw<AnyGlobalAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 40 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 41 | SetDisplayName(Option<String>), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 42 | SetAvatar(Option<OwnedMxcUri>), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 43 | /// uploads the image and points the profile at it, same byte cap as any upload |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 44 | UploadAvatar { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 45 | mimetype: String, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 46 | bytes: Vec<u8>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 47 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 48 | RenameDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 49 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 50 | display_name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 51 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 52 | DeleteDevices { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 53 | device_ids: Vec<OwnedDeviceId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 54 | auth: Option<crate::InteractiveAuth>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 55 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 56 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 57 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 58 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 59 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 60 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 61 | pub enum RoomCommand { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 62 | /// the snapshot turns up as `Event::TimelineReset`. opening an open room sends a fresh one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 63 | Open(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 64 | Close(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 65 | Join { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 66 | room: OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 67 | via: Vec<OwnedServerName>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 68 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 69 | Leave(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 70 | Forget(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 71 | AcceptInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 72 | RejectInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 73 | InviteUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 74 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 75 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 76 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 77 | KickUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 78 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 79 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 80 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 81 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 82 | BanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 83 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 84 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 85 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 86 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 87 | UnbanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 88 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 89 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 90 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 91 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 92 | SetPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 93 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 94 | changes: PowerLevelChanges, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 95 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 96 | SetUserPowerLevel { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 97 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 98 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 99 | level: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 100 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 101 | Create(CreateRoomOptions), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 102 | /// hands back the existing dm if there is one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 103 | CreateDirect(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 104 | CancelSend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 105 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 106 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 107 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 108 | RetrySend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 109 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 110 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 111 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 112 | SetTyping { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 113 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 114 | typing: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 115 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 116 | SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 117 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 118 | event_type: RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 119 | content: Raw<AnyRoomAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 120 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 121 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 122 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 123 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 124 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 125 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 126 | pub struct CreateRoomOptions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 127 | pub name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 128 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 129 | pub alias_localpart: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 130 | pub invite: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 131 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 132 | pub visibility: RoomVisibility, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 133 | pub preset: Option<RoomPreset>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 134 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 135 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 136 | impl CreateRoomOptions { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 137 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 138 | pub fn with_name(mut self, name: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 139 | self.name = Some(name.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 140 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 141 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 142 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 143 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 144 | pub fn with_topic(mut self, topic: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 145 | self.topic = Some(topic.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 146 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 147 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 148 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 149 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 150 | pub fn with_alias_localpart(mut self, localpart: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 151 | self.alias_localpart = Some(localpart.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 152 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 153 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 154 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 155 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 156 | pub fn with_invite(mut self, invite: impl IntoIterator<Item = OwnedUserId>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 157 | self.invite = invite.into_iter().collect(); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 158 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 159 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 160 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 161 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 162 | pub const fn with_direct(mut self, direct: bool) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 163 | self.direct = direct; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 164 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 165 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 166 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 167 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 168 | pub const fn with_visibility(mut self, visibility: RoomVisibility) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 169 | self.visibility = visibility; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 170 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 171 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 172 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 173 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 174 | pub const fn with_preset(mut self, preset: RoomPreset) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 175 | self.preset = Some(preset); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 176 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 177 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 178 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 179 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 180 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 181 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 182 | pub enum RoomVisibility { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 183 | #[default] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 184 | Private, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 185 | Public, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 186 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 187 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 188 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 189 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 190 | pub enum RoomPreset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 191 | PrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 192 | TrustedPrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 193 | PublicChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 194 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 195 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 196 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 197 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 198 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 199 | pub enum TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 200 | OpenThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 201 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 202 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 203 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 204 | CloseThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 205 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 206 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 207 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 208 | /// Re-emit an authoritative reset for an open room or thread without |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 209 | /// closing it. The reset arrives before this command's terminal result. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 210 | Resync { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 211 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 212 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 213 | Paginate { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 214 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 215 | limit: u16, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 216 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 217 | Send { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 218 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 219 | content: MessageContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 220 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 221 | Edit { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 222 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 223 | target: EventRef, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 224 | content: MessageEditContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 225 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 226 | /// redacting your own unsent message just cancels it |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 227 | Redact { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 228 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 229 | target: EventRef, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 230 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 231 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 232 | ToggleReaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 233 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 234 | target: EventRef, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 235 | key: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 236 | }, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 237 | /// works on a closed room too, it just can't refuse to move the marker backwards |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 238 | MarkRead { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 239 | timeline_id: TimelineId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 240 | event_id: OwnedEventId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 241 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 242 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 243 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 244 | impl TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 245 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 246 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 247 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 248 | Self::OpenThread { room_id, .. } | Self::CloseThread { room_id, .. } => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 249 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 250 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 251 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 252 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 253 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 254 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 255 | | Self::MarkRead { timeline_id, .. } => timeline_id.room_id(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 256 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 257 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 258 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 259 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 260 | pub const fn timeline_id(&self) -> Option<&TimelineId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 261 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 262 | Self::OpenThread { .. } | Self::CloseThread { .. } => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 263 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 264 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 265 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 266 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 267 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 268 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 269 | | Self::MarkRead { timeline_id, .. } => Some(timeline_id), |
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 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 273 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 274 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 275 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 276 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 277 | pub enum TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 278 | Room(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 279 | Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 280 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 281 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 282 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 283 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 284 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 285 | impl TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 286 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 287 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 288 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 289 | Self::Room(room_id) | Self::Thread { room_id, .. } => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 290 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 291 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 292 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 293 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 294 | pub fn thread(room_id: OwnedRoomId, root_event_id: OwnedEventId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 295 | Self::Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 296 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 297 | root_event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 298 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 299 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 300 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 301 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 302 | pub fn thread_root(&self) -> Option<&OwnedEventId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 303 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 304 | Self::Room(_) => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 305 | Self::Thread { root_event_id, .. } => Some(root_event_id), |
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 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 309 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 310 | impl From<OwnedRoomId> for TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 311 | fn from(room_id: OwnedRoomId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 312 | Self::Room(room_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 313 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 314 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 315 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 316 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 317 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 318 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 319 | pub enum MediaCommand { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 320 | /// succeeds once the send queue has it. progress and failure arrive as events |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 321 | Upload(AttachmentUpload), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 322 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 323 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 324 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 325 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 326 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 327 | pub struct AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 328 | pub timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 329 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 330 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 331 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 332 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 333 | pub details: Option<UploadDetails>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 334 | pub thumbnail: Option<UploadThumbnail>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 335 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 336 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 337 | impl AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 338 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 339 | pub fn new( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 340 | timeline_id: impl Into<TimelineId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 341 | filename: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 342 | mimetype: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 343 | bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 344 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 345 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 346 | timeline_id: timeline_id.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 347 | filename: filename.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 348 | mimetype: mimetype.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 349 | bytes, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 350 | caption: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 351 | details: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 352 | thumbnail: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 353 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 354 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 355 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 356 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 357 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 358 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 359 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 360 | pub enum UploadDetails { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 361 | Image { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 362 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 363 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 364 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 365 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 366 | Video { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 367 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 368 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 369 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 370 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 371 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 372 | Audio { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 373 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 374 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 375 | Voice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 376 | duration_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 377 | waveform: Vec<u16>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 378 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 379 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 380 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 381 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 382 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 383 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 384 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 385 | pub struct UploadThumbnail { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 386 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 387 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 388 | pub width: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 389 | pub height: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 390 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 391 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 392 | impl UploadThumbnail { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 393 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 394 | pub fn new(bytes: Vec<u8>, mimetype: impl Into<String>, width: u32, height: u32) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 395 | Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 396 | bytes, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 397 | mimetype: mimetype.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 398 | width, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 399 | height, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 400 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 401 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 402 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 403 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 404 | #[derive(Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 405 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 406 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 407 | pub enum EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 408 | Recover(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 409 | CreateKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 410 | EnableKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 411 | DisableKeyBackup { delete_from_server: bool }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 412 | RecoverKeyBackup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 413 | StartVerification(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 414 | Verify(VerificationAction), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 415 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 416 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 417 | impl fmt::Debug for EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 418 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 419 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 420 | Self::Recover(_) => formatter.debug_tuple("Recover").field(&"...").finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 421 | Self::CreateKeyBackup => formatter.write_str("CreateKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 422 | Self::EnableKeyBackup => formatter.write_str("EnableKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 423 | Self::DisableKeyBackup { delete_from_server } => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 424 | .debug_struct("DisableKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 425 | .field("delete_from_server", delete_from_server) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 426 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 427 | Self::RecoverKeyBackup(_) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 428 | .debug_tuple("RecoverKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 429 | .field(&"...") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 430 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 431 | Self::StartVerification(target) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 432 | .debug_tuple("StartVerification") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 433 | .field(target) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 434 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 435 | Self::Verify(action) => formatter.debug_tuple("Verify").field(action).finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 436 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 437 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 438 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 439 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 440 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 441 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 442 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 443 | pub enum NotificationCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 444 | SetRoomMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 445 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 446 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 447 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 448 | ResetRoomMode(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 449 | SetDefaultMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 450 | encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 451 | one_to_one: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 452 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 453 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 454 | AddKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 455 | RemoveKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 456 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 457 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 458 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 459 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 460 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 461 | pub enum LifecycleCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 462 | Shutdown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 463 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 464 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 465 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 466 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 467 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 468 | pub enum CommandOutput { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 469 | Done, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 470 | Room(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 471 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 472 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 473 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 474 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 475 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 476 | pub enum MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 477 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 478 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 479 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 480 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 481 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 482 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 483 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 484 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 485 | Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 486 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 487 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 488 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 489 | notify_replied_to: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 490 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 491 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 492 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 493 | impl MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 494 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 495 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 496 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 497 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 498 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 499 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 500 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 501 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 502 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 503 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 504 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 505 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 506 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 507 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 508 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 509 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 510 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 511 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 512 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 513 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 514 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 515 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 516 | pub fn reply(event_id: OwnedEventId, content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 517 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 518 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 519 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 520 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 521 | notify_replied_to: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 522 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 523 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 524 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 525 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 526 | pub fn reply_without_notification( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 527 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 528 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 529 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 530 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 531 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 532 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 533 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 534 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 535 | notify_replied_to: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 536 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 537 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 538 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 539 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 540 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 541 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 542 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 543 | pub enum MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 544 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 545 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 546 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 547 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 548 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 549 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 550 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 551 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 552 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 553 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 554 | impl MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 555 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 556 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 557 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 558 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 559 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 560 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 561 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 562 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 563 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 564 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 565 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 566 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 567 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 568 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 569 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 570 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 571 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 572 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 573 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 574 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 575 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 576 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 577 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 578 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 579 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 580 | pub struct RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 581 | pub body: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 582 | pub formatted_body: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 583 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 584 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 585 | impl RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 586 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 587 | pub fn plain(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 588 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 589 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 590 | formatted_body: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 591 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 592 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 593 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 594 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 595 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 596 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 597 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 598 | formatted_body: Some(formatted_body.into()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 599 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 600 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 601 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 602 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 603 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 604 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 605 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 606 | pub struct MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 607 | pub user_ids: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 608 | pub room: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 609 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 610 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 611 | impl MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 612 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 613 | pub fn with_user_ids(user_ids: impl IntoIterator<Item = OwnedUserId>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 614 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 615 | user_ids: user_ids.into_iter().collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 616 | room: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 617 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 618 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 619 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 620 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 621 | pub fn room() -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 622 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 623 | user_ids: Vec::new(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 624 | room: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 625 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 626 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 627 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 628 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 629 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 630 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 631 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 632 | pub enum Event { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 633 | ConnectionChanged(ConnectionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 634 | Authenticated { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 635 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 636 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 637 | /// Refresh tokens changed. Persist a fresh `ClientHandle::session_record()` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 638 | /// atomically; a record captured before this event may no longer restore. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 639 | SessionTokensChanged, |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 640 | /// the server stopped honouring our token and the engine stops. a soft logout |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 641 | /// names the device to log in again as, keeping the store. otherwise the record |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 642 | /// and the store are both dead |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 643 | SessionAccessRejected { |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 644 | soft_logout: Option<OwnedDeviceId>, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 645 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 646 | NotificationSettingsChanged, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 647 | VerificationTargetChanged(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 648 | RoomsChanged, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 649 | /// replaces whatever you had for this timeline. every diff after it applies to it |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 650 | TimelineReset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 651 | timeline_id: TimelineId, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 652 | items: Vector<TimelineItem>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 653 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 654 | TimelineChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 655 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 656 | diffs: Vec<TimelineDiff>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 657 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 658 | HistoryChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 659 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 660 | state: HistoryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 661 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 662 | /// the timeline was closed, or its room was left, and nothing more comes for it |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 663 | /// until another `TimelineReset` |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 664 | TimelineClosed { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 665 | timeline_id: TimelineId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 666 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 667 | /// a room that stops being watched says so with an empty `users` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 668 | TypingChanged(TypingState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 669 | MediaUploadProgress { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 670 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 671 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 672 | uploaded_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 673 | total_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 674 | complete: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 675 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 676 | /// not the end of it. `will_retry` means the send queue has another go by itself, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 677 | /// otherwise it waits for `retry_send` or `cancel_send` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 678 | MediaUploadFailed { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 679 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 680 | transaction_id: OwnedTransactionId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 681 | kind: crate::ErrorKind, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 682 | will_retry: bool, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 683 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 684 | /// every upload ends with exactly one of these |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 685 | MediaUploadFinished { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 686 | room_id: OwnedRoomId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 687 | transaction_id: OwnedTransactionId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 688 | outcome: UploadOutcome, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 689 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 690 | EncryptionChanged(EncryptionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 691 | VerificationChanged(VerificationState), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 692 | /// logout went through and the engine stops. delete the record and the store |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 693 | LoggedOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 694 | Failed(EngineFailure), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 695 | /// always the last event. keep the saved record unless `LoggedOut` or a |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 696 | /// hard `SessionAccessRejected` came first. commands still in flight answer `Interrupted` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 697 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 698 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 699 | |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 700 | #[derive(Clone, Debug, Eq, PartialEq)] |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 701 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 702 | #[non_exhaustive] |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 703 | pub enum UploadOutcome { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 704 | Sent { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 705 | event_id: OwnedEventId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 706 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 707 | Cancelled, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 708 | /// its room was forgotten, and the queue with it |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 709 | RoomForgotten, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 710 | /// the sdk's update channel overflowed while it ended, so whether it was sent is unknown |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 711 | Missed, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 712 | } |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 713 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 714 | /// why `Engine::run` came back, when nothing went wrong |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 715 | #[derive(Clone, Debug, Eq, PartialEq)] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 716 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 717 | #[non_exhaustive] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 718 | pub enum Termination { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 719 | ShutDown, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 720 | /// every `ClientHandle` was dropped, so nobody could have asked for anything else |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 721 | HandlesDropped, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 722 | LoggedOut, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 723 | /// the server rejected our token for good |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 724 | AccessRevoked, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 725 | /// the server wants this device to log in again, and its e2ee keys live in the store |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 726 | SoftLoggedOut { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 727 | device_id: OwnedDeviceId, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 728 | }, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 729 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 730 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 731 | impl Termination { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 732 | #[must_use] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 733 | pub const fn retain(&self) -> Retain { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 734 | match self { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 735 | Self::ShutDown | Self::HandlesDropped => Retain::RecordAndStore, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 736 | Self::SoftLoggedOut { .. } => Retain::Store, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 737 | Self::LoggedOut | Self::AccessRevoked => Retain::Nothing, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 738 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 739 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 740 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 741 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 742 | /// what's still worth keeping of the saved record and the store |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 743 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 744 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 745 | pub enum Retain { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 746 | RecordAndStore, |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 747 | /// keep the store and a record naming the device to log in again as |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 748 | Store, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 749 | Nothing, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 750 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 751 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 752 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 753 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 754 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 755 | pub enum ConnectionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 756 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 757 | Connecting, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 758 | Online, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 759 | Offline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 760 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 761 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 762 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 763 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 764 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 765 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 766 | pub struct RoomSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 767 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 768 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 769 | pub membership: RoomMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 770 | pub unread_messages: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 771 | pub unread_mentions: u64, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 772 | /// unread events the push rules said to notify about, which is neither of the above |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 773 | pub unread_notifications: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 774 | pub encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 775 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 776 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 777 | pub favourite: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 778 | pub low_priority: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 779 | pub avatar: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 780 | pub latest_event_timestamp_ms: Option<u64>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 781 | pub latest_event: Option<LatestEvent>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 782 | pub notification_mode: Option<RoomNotificationMode>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 783 | pub notification_mode_custom: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 784 | pub topic: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 785 | pub canonical_alias: Option<OwnedRoomAliasId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 786 | pub joined_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 787 | pub invited_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 788 | /// who a nameless room gets named after |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 789 | pub heroes: Vec<RoomHero>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 790 | /// set once the room has been upgraded, this is where everyone went |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 791 | pub successor: Option<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 792 | pub inviter: Option<OwnedUserId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 793 | /// joined spaces that list this room as a child |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 794 | pub parent_spaces: Vec<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 795 | /// for a space, the children it lists, joined or not |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 796 | pub children: Vec<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 797 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 798 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 799 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 800 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 801 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 802 | pub struct RoomHero { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 803 | pub user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 804 | pub display_name: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 805 | pub avatar: Option<OwnedMxcUri>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 806 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 807 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 808 | /// enough for a room list preview line. `kind` and `body` are only set for messages, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 809 | /// and an edit shows its new text |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 810 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 811 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 812 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 813 | pub struct LatestEvent { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 814 | pub sender: Option<OwnedUserId>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 815 | pub kind: Option<MessageKind>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 816 | pub body: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 817 | pub timestamp_ms: Option<u64>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 818 | pub send_state: SendState, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 819 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 820 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 821 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 822 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 823 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 824 | pub struct Profile { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 825 | pub user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 826 | pub display_name: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 827 | pub avatar: Option<OwnedMxcUri>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 828 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 829 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 830 | /// 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 | 831 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 832 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 833 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 834 | pub struct SpaceChild { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 835 | pub room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 836 | pub name: String, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 837 | pub topic: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 838 | pub avatar: Option<OwnedMxcUri>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 839 | pub canonical_alias: Option<OwnedRoomAliasId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 840 | pub joined_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 841 | pub space: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 842 | pub children_count: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 843 | pub membership: Option<RoomMembership>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 844 | pub via: Vec<OwnedServerName>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 845 | pub suggested: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 846 | pub world_readable: Option<bool>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 847 | pub guest_can_join: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 848 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 849 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 850 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 851 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 852 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 853 | pub enum RoomNotificationMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 854 | AllMessages, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 855 | MentionsAndKeywordsOnly, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 856 | Mute, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 857 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 858 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 859 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 860 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 861 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 862 | pub struct RoomNotificationSettings { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 863 | pub mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 864 | pub custom: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 865 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 866 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 867 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 868 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 869 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 870 | pub enum PushNotificationStatus { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 871 | Event(Box<PushNotification>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 872 | NotFound, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 873 | FilteredOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 874 | Redacted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 875 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 876 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 877 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 878 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 879 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 880 | pub struct PushNotification { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 881 | pub event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 882 | pub event: PushNotificationEvent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 883 | pub sender: PushNotificationSender, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 884 | pub room: PushNotificationRoom, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 885 | pub noisy: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 886 | pub has_mention: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 887 | pub thread_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 888 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 889 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 890 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 891 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 892 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 893 | pub struct PushNotificationSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 894 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 895 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 896 | pub avatar_url: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 897 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 898 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 899 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 900 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 901 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 902 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 903 | pub struct PushNotificationRoom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 904 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 905 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 906 | pub avatar_url: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 907 | pub canonical_alias: Option<OwnedRoomAliasId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 908 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 909 | pub encrypted: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 910 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 911 | pub joined_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 912 | pub service_members: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 913 | pub active_service_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 914 | pub space: bool, |
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 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 918 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 919 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 920 | pub enum PushNotificationEvent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 921 | Timeline(Raw<AnySyncTimelineEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 922 | Invite(Raw<StrippedRoomMemberEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 923 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 924 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 925 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 926 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 927 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 928 | pub struct RoomPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 929 | pub ban: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 930 | pub invite: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 931 | pub kick: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 932 | pub redact: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 933 | pub events_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 934 | pub state_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 935 | pub users_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 936 | pub room_notification: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 937 | pub users: Vec<(OwnedUserId, i64)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 938 | pub events: Vec<(String, i64)>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 939 | /// in rooms from version 12 the creators outrank everyone and aren't listed in `users` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 940 | pub creators: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 941 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 942 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 943 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 944 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 945 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 946 | pub struct PowerLevelChanges { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 947 | pub ban: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 948 | pub invite: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 949 | pub kick: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 950 | pub redact: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 951 | pub events_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 952 | pub state_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 953 | pub users_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 954 | pub room_notification: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 955 | pub room_name: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 956 | pub room_avatar: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 957 | pub room_topic: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 958 | pub space_child: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 959 | pub beacon: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 960 | pub beacon_info: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 961 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 962 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 963 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 964 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 965 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 966 | pub enum RoomMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 967 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 968 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 969 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 970 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 971 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 972 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 973 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 974 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 975 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 976 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 977 | pub struct RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 978 | pub membership: Option<RoomMembership>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 979 | pub category: Option<RoomCategory>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 980 | pub favourite: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 981 | pub unread_only: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 982 | pub search: Option<String>, |
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 | impl RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 986 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 987 | pub fn with_membership(mut self, membership: RoomMembership) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 988 | self.membership = Some(membership); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 989 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 990 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 991 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 992 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 993 | pub fn with_category(mut self, category: RoomCategory) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 994 | self.category = Some(category); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 995 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 996 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 997 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 998 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 999 | pub fn with_favourite(mut self, favourite: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1000 | self.favourite = Some(favourite); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1001 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1002 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1003 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1004 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1005 | pub const fn with_unread_only(mut self, unread_only: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1006 | self.unread_only = unread_only; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1007 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1008 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1009 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1010 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1011 | pub fn with_search(mut self, search: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1012 | self.search = Some(search.into()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1013 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1014 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1015 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1016 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1017 | pub fn matches(&self, room: &RoomSummary) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1018 | self.matcher().matches(room) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1019 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1020 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1021 | /// lowercases the search once, for filtering a whole list |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1022 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1023 | pub fn matcher(&self) -> RoomMatcher<'_> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1024 | RoomMatcher { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1025 | filter: self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1026 | search: self.search.as_deref().map(str::to_lowercase), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1027 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1028 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1029 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1030 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1031 | #[derive(Debug)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1032 | pub struct RoomMatcher<'a> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1033 | filter: &'a RoomListFilter, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1034 | search: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1035 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1036 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1037 | impl RoomMatcher<'_> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1038 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1039 | pub fn matches(&self, room: &RoomSummary) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1040 | let filter = self.filter; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1041 | filter |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1042 | .membership |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1043 | .is_none_or(|membership| room.membership == membership) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1044 | && filter.category.is_none_or(|category| match category { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1045 | RoomCategory::People => room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1046 | RoomCategory::Rooms => !room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1047 | RoomCategory::Spaces => room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1048 | }) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1049 | && filter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1050 | .favourite |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1051 | .is_none_or(|favourite| room.favourite == favourite) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1052 | && (!filter.unread_only || room.unread_messages > 0 || room.unread_mentions > 0) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1053 | && self.search.as_ref().is_none_or(|search| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1054 | room.name.to_lowercase().contains(search) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1055 | || room.room_id.as_str().to_lowercase().contains(search) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1056 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1057 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1058 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1059 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1060 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1061 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1062 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1063 | pub enum RoomCategory { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1064 | People, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1065 | Rooms, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1066 | Spaces, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1067 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1068 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1069 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1070 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1071 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1072 | pub enum MemberFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1073 | Active, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1074 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1075 | Invited, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1076 | Banned, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1077 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1078 | All, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1079 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1080 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1081 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1082 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1083 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1084 | pub enum MemberMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1085 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1086 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1087 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1088 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1089 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1090 | Custom(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1091 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1092 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1093 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1094 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1095 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1096 | pub struct MemberSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1097 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1098 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1099 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1100 | pub avatar: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1101 | pub membership: MemberMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1102 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1103 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1104 | pub ignored: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1105 | pub service: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1106 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1107 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1108 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1109 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1110 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1111 | pub struct OwnDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1112 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1113 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1114 | pub last_seen_ip: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1115 | pub last_seen_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1116 | pub current: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1117 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1118 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1119 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1120 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1121 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1122 | pub enum TimelineItem { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1123 | Event(Box<TimelineEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1124 | DayDivider { timestamp_ms: u64 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1125 | ReadMarker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1126 | TimelineStart, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1127 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1128 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1129 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1130 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1131 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1132 | pub enum TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1133 | Append { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1134 | Clear, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1135 | PushFront { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1136 | PushBack { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1137 | PopFront, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1138 | PopBack, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1139 | Insert { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1140 | Set { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1141 | Remove { index: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1142 | Truncate { length: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1143 | Reset { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1144 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1145 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1146 | #[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1147 | #[error("timeline diff is incompatible with the current {length}-item snapshot")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1148 | pub struct TimelineDiffError { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1149 | pub length: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1150 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1151 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1152 | impl TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1153 | /// Apply a diff only when its indices match the current snapshot. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1154 | /// On error the snapshot is unchanged; request `TimelineCommand::Resync` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1155 | /// and ignore further diffs until the corresponding `TimelineReset`. |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1156 | pub fn try_apply(self, items: &mut Vector<TimelineItem>) -> Result<(), TimelineDiffError> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1157 | let length = items.len(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1158 | if self.length_after(length).is_none() { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1159 | return Err(TimelineDiffError { length }); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1160 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1161 | self.apply(items); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1162 | Ok(()) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1163 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1164 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1165 | /// a whole `TimelineChanged` or none of it. whether a diff fits depends only on the |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1166 | /// length before it, so the batch is checked against lengths alone before anything |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1167 | /// moves. the error carries the length the snapshot would have had at the misfit |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1168 | pub fn try_apply_all( |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1169 | diffs: Vec<Self>, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1170 | items: &mut Vector<TimelineItem>, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1171 | ) -> Result<(), TimelineDiffError> { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1172 | diffs.iter().try_fold(items.len(), |length, diff| { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1173 | diff.length_after(length) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1174 | .ok_or(TimelineDiffError { length }) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1175 | })?; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1176 | for diff in diffs { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1177 | diff.apply(items); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1178 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1179 | Ok(()) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1180 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1181 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1182 | fn length_after(&self, length: usize) -> Option<usize> { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1183 | match self { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1184 | Self::Append { values } => Some(length + values.len()), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1185 | Self::Clear => Some(0), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1186 | Self::PushFront { .. } | Self::PushBack { .. } => Some(length + 1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1187 | Self::PopFront | Self::PopBack => length.checked_sub(1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1188 | Self::Insert { index, .. } => (*index <= length).then_some(length + 1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1189 | Self::Set { index, .. } => (*index < length).then_some(length), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1190 | Self::Remove { index } => (*index < length).then(|| length - 1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1191 | Self::Truncate { length: target } => (*target <= length).then_some(*target), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1192 | Self::Reset { values } => Some(values.len()), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1193 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1194 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1195 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1196 | fn apply(self, items: &mut Vector<TimelineItem>) { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1197 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1198 | Self::Append { values } => items.extend(values), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1199 | Self::Clear => items.clear(), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1200 | Self::PushFront { value } => items.push_front(value), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1201 | Self::PushBack { value } => items.push_back(value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1202 | Self::PopFront => { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1203 | items.pop_front(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1204 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1205 | Self::PopBack => { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1206 | items.pop_back(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1207 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1208 | Self::Insert { index, value } => items.insert(index, value), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1209 | Self::Set { index, value } => { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1210 | items.set(index, value); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1211 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1212 | Self::Remove { index } => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1213 | items.remove(index); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1214 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1215 | Self::Truncate { length } => items.truncate(length), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1216 | Self::Reset { values } => *items = values.into_iter().collect(), |
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 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1221 | #[cfg(test)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1222 | mod tests { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1223 | use imbl::{Vector, vector}; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1224 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1225 | use super::{TimelineDiff, TimelineItem}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1226 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1227 | fn item(timestamp_ms: u64) -> TimelineItem { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1228 | TimelineItem::DayDivider { timestamp_ms } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1229 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1230 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1231 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1232 | fn timeline_diff_try_apply_handles_every_variant() { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1233 | let mut items = vector![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1234 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1235 | TimelineDiff::Append { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1236 | values: vec![item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1237 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1238 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1239 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1240 | assert_eq!(items, vector![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1241 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1242 | TimelineDiff::Clear.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1243 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1244 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1245 | TimelineDiff::PushFront { value: item(2) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1246 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1247 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1248 | TimelineDiff::PushBack { value: item(3) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1249 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1250 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1251 | assert_eq!(items, vector![item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1252 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1253 | TimelineDiff::PopFront.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1254 | TimelineDiff::PopBack.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1255 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1256 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1257 | TimelineDiff::Reset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1258 | values: vec![item(1), item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1259 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1260 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1261 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1262 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1263 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1264 | value: item(2), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1265 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1266 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1267 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1268 | assert_eq!(items, vector![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1269 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1270 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1271 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1272 | value: item(4), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1273 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1274 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1275 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1276 | assert_eq!(items, vector![item(1), item(4), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1277 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1278 | TimelineDiff::Remove { index: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1279 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1280 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1281 | assert_eq!(items, vector![item(1), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1282 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1283 | TimelineDiff::Truncate { length: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1284 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1285 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1286 | assert_eq!(items, vector![item(1)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1287 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1288 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1289 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1290 | fn invalid_timeline_diff_leaves_snapshot_unchanged() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1291 | let invalid = [ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1292 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1293 | index: 3, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1294 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1295 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1296 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1297 | index: 2, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1298 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1299 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1300 | TimelineDiff::Remove { index: 2 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1301 | TimelineDiff::Truncate { length: 3 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1302 | ]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1303 | for diff in invalid { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1304 | let mut items = vector![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1305 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 2); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1306 | assert_eq!(items, vector![item(1), item(2)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1307 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1308 | for diff in [TimelineDiff::PopFront, TimelineDiff::PopBack] { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1309 | let mut items = Vector::new(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1310 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1311 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1312 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1313 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1314 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1315 | #[test] |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1316 | fn a_batch_that_goes_wrong_halfway_changes_nothing() { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1317 | let mut items = vector![item(1), item(2)]; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1318 | let batch = vec![ |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1319 | TimelineDiff::PushBack { value: item(3) }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1320 | TimelineDiff::Remove { index: 0 }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1321 | TimelineDiff::Set { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1322 | index: 2, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1323 | value: item(4), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1324 | }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1325 | ]; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1326 | assert_eq!( |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1327 | TimelineDiff::try_apply_all(batch, &mut items) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1328 | .unwrap_err() |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1329 | .length, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1330 | 2 |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1331 | ); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1332 | assert_eq!(items, vector![item(1), item(2)]); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1333 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1334 | let batch = vec![ |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1335 | TimelineDiff::PushBack { value: item(3) }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1336 | TimelineDiff::Remove { index: 0 }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1337 | TimelineDiff::Set { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1338 | index: 1, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1339 | value: item(4), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1340 | }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1341 | ]; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1342 | TimelineDiff::try_apply_all(batch, &mut items).unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1343 | assert_eq!(items, vector![item(2), item(4)]); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1344 | } |
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, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1348 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1349 | pub struct TimelineItemId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1350 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1351 | impl TimelineItemId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1352 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1353 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1354 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1355 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1356 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1357 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1358 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1359 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1360 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1361 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1362 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1363 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1364 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1365 | pub struct TimelineEvent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1366 | pub item_id: TimelineItemId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1367 | pub event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1368 | pub transaction_id: Option<OwnedTransactionId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1369 | pub sender: Sender, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1370 | pub timestamp_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1371 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1372 | pub send_state: SendState, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1373 | pub content: TimelineContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1374 | pub reply_to: Option<ReplyReference>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1375 | pub thread_root: Option<OwnedEventId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1376 | pub thread_summary: Option<ThreadSummary>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1377 | pub reactions: Vec<Reaction>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1378 | pub read_by: Vec<OwnedUserId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1379 | pub editable: bool, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1380 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1381 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1382 | impl TimelineEvent { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1383 | /// what to hand edit, redact and react. works before the server has echoed it back |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1384 | #[must_use] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1385 | pub fn target(&self) -> Option<EventRef> { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1386 | self.event_id |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1387 | .clone() |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1388 | .map(EventRef::Remote) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1389 | .or_else(|| self.transaction_id.clone().map(EventRef::Local)) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1390 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1391 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1392 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1393 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1394 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1395 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1396 | pub enum EventRef { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1397 | Remote(OwnedEventId), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1398 | /// a local echo, by the transaction id it was queued under |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1399 | Local(OwnedTransactionId), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1400 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1401 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1402 | impl From<OwnedEventId> for EventRef { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1403 | fn from(event_id: OwnedEventId) -> Self { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1404 | Self::Remote(event_id) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1405 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1406 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1407 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1408 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1409 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1410 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1411 | pub struct Sender { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1412 | pub user_id: OwnedUserId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1413 | pub display_name: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1414 | pub avatar: Option<OwnedMxcUri>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1415 | /// someone else in the room goes by the same name, so show the user id too |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1416 | pub name_ambiguous: bool, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1417 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1418 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1419 | impl Sender { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1420 | #[must_use] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1421 | pub fn name(&self) -> &str { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1422 | self.display_name |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1423 | .as_deref() |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1424 | .unwrap_or_else(|| self.user_id.as_str()) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1425 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1426 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1427 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1428 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1429 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1430 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1431 | pub enum TimelineContent { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1432 | Message(Message), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1433 | Sticker { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1434 | body: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1435 | media: MediaDescriptor, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1436 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1437 | Poll { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1438 | question: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1439 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1440 | Redacted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1441 | UnableToDecrypt(UtdCause), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1442 | Membership { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1443 | user_id: OwnedUserId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1444 | display_name: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1445 | change: MembershipChange, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1446 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1447 | Profile { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1448 | user_id: OwnedUserId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1449 | display_name: Option<Change<Option<String>>>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1450 | avatar: Option<Change<Option<OwnedMxcUri>>>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1451 | }, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1452 | /// `None` means it was cleared, or the event was redacted |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1453 | RoomName(Option<String>), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1454 | RoomTopic(Option<String>), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1455 | RoomAvatar(Option<OwnedMxcUri>), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1456 | EncryptionEnabled, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1457 | RoomCreated, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1458 | RoomUpgraded { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1459 | successor: OwnedRoomId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1460 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1461 | OtherState { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1462 | event_type: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1463 | state_key: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1464 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1465 | Other { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1466 | event_type: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1467 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1468 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1469 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1470 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1471 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1472 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1473 | pub struct Message { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1474 | pub kind: MessageKind, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1475 | pub body: String, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1476 | /// only for `MessageKind::Location` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1477 | pub geo_uri: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1478 | pub formatted_body: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1479 | pub mentions: Option<MessageMentions>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1480 | pub edited: bool, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1481 | pub media: Option<MediaDescriptor>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1482 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1483 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1484 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1485 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1486 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1487 | pub enum MessageKind { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1488 | Text, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1489 | Emote, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1490 | Notice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1491 | ServerNotice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1492 | Image, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1493 | Video, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1494 | Audio, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1495 | File, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1496 | Location, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1497 | VerificationRequest, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1498 | Other(String), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1499 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1500 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1501 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1502 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1503 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1504 | pub enum MembershipChange { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1505 | Joined, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1506 | Left, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1507 | Banned, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1508 | Unbanned, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1509 | Kicked, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1510 | KickedAndBanned, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1511 | Invited, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1512 | InvitationAccepted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1513 | InvitationRejected, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1514 | InvitationRevoked, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1515 | Knocked, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1516 | KnockAccepted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1517 | KnockRetracted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1518 | KnockDenied, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1519 | /// nothing a person would call a change, or something the sdk couldn't make sense of |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1520 | Other, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1521 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1522 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1523 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1524 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1525 | pub struct Change<T> { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1526 | pub old: T, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1527 | pub new: T, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1528 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1529 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1530 | /// why a message couldn't be read, worth telling the user since some of these they can fix |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1531 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1532 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1533 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1534 | pub enum UtdCause { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1535 | Unknown, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1536 | SentBeforeWeJoined, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1537 | VerificationViolation, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1538 | UnsignedDevice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1539 | UnknownDevice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1540 | HistoricalMessageAndBackupIsDisabled, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1541 | WithheldForUnverifiedOrInsecureDevice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1542 | WithheldBySender, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1543 | HistoricalMessageAndDeviceIsUnverified, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1544 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1545 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1546 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1547 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1548 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1549 | pub struct ThreadSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1550 | pub reply_count: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1551 | pub latest_event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1552 | pub latest_event_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1553 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1554 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1555 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1556 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1557 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1558 | pub enum SendState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1559 | Sent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1560 | Sending, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1561 | /// `will_retry` means macltok has it in hand. otherwise it's wedged until you |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1562 | /// `retry_send` or `cancel_send`, so that's when to show a retry button |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1563 | Failed { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1564 | will_retry: bool, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1565 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1566 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1567 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1568 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1569 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1570 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1571 | pub struct ReplyReference { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1572 | pub event_id: OwnedEventId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1573 | pub details: ReplyDetails, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1574 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1575 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1576 | /// the replied-to event. macltok asks for it when it isn't loaded, `Pending` then turns into one of the others |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1577 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1578 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1579 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1580 | pub enum ReplyDetails { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1581 | Pending, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1582 | Ready { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1583 | sender: Sender, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1584 | content: Box<TimelineContent>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1585 | timestamp_ms: u64, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1586 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1587 | Unavailable, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1588 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1589 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1590 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1591 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1592 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1593 | pub struct Reaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1594 | pub key: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1595 | pub count: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1596 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1597 | pub senders: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1598 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1599 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1600 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1601 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1602 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1603 | pub struct MediaDescriptor { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1604 | pub id: MediaId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1605 | pub kind: MediaKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1606 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1607 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1608 | pub mimetype: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1609 | pub size_bytes: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1610 | pub width: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1611 | pub height: Option<u64>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1612 | pub duration_ms: Option<u64>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1613 | pub blurhash: Option<String>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1614 | /// the uploader sent a thumbnail, so `MediaSize::Thumbnail` won't need the server to resize |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1615 | pub has_thumbnail: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1616 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1617 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1618 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1619 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1620 | pub struct MediaId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1621 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1622 | impl MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1623 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1624 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1625 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1626 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1627 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1628 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1629 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1630 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1631 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1632 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1633 | /// media ids are opaque but they do have to survive a trip through a browser. a made up one just fails `MediaUnknown` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1634 | impl std::str::FromStr for MediaId { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1635 | type Err = std::convert::Infallible; |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1636 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1637 | fn from_str(value: &str) -> Result<Self, Self::Err> { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1638 | Ok(Self(value.to_owned())) |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1639 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1640 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1641 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1642 | impl From<String> for MediaId { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1643 | fn from(value: String) -> Self { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1644 | Self(value) |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1645 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1646 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1647 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1648 | impl std::fmt::Display for MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1649 | fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1650 | self.0.fmt(formatter) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1651 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1652 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1653 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1654 | #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1655 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1656 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1657 | pub enum MediaSize { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1658 | Full, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1659 | /// a hint. an uploader's own thumbnail wins over the server resizing anything |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1660 | Thumbnail { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1661 | width: u32, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1662 | height: u32, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1663 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1664 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1665 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1666 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1667 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1668 | pub struct Media { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1669 | pub bytes: Arc<[u8]>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1670 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1671 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1672 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1673 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1674 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1675 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1676 | pub enum MediaKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1677 | Image, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1678 | Video, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1679 | Audio, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1680 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1681 | Sticker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1682 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1683 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1684 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1685 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1686 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1687 | pub struct TypingState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1688 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1689 | pub users: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1690 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1691 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1692 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1693 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1694 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1695 | pub enum HistoryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1696 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1697 | Loading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1698 | StartReached, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1699 | Failed(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1700 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1701 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1702 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1703 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1704 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1705 | pub struct EncryptionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1706 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1707 | pub device_verified: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1708 | pub recovery: RecoveryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1709 | pub key_backup: KeyBackupState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1710 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1711 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1712 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1713 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1714 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1715 | pub enum KeyBackupState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1716 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1717 | Creating, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1718 | Enabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1719 | Resuming, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1720 | Downloading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1721 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1722 | Disabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1723 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1724 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1725 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1726 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1727 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1728 | pub enum RecoveryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1729 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1730 | Disabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1731 | Incomplete, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1732 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1733 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1734 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1735 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1736 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1737 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1738 | pub enum VerificationAction { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1739 | /// take up a request another device sent, which arrives as `VerificationState::Incoming` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1740 | Accept, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1741 | Confirm, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1742 | Reject, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1743 | Cancel, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1744 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1745 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1746 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1747 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1748 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1749 | pub enum VerificationTarget { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1750 | OwnIdentity, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1751 | User(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1752 | Device { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1753 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1754 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1755 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1756 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1757 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1758 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1759 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1760 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1761 | pub enum VerificationState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1762 | Waiting, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1763 | /// someone else asked. `Accept` to go ahead, `Cancel` to turn them down |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1764 | Incoming { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1765 | user_id: OwnedUserId, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1766 | device_id: Option<OwnedDeviceId>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1767 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1768 | Comparison { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1769 | emojis: Vec<(String, String)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1770 | decimals: (u16, u16, u16), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1771 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1772 | Confirmed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1773 | Done, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1774 | Cancelled(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1775 | Failed(VerificationFailure), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1776 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1777 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1778 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1779 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1780 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1781 | pub enum VerificationFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1782 | RequestAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1783 | SasStartup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1784 | SasAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1785 | RequestStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1786 | SasStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1787 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1788 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1789 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1790 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1791 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1792 | pub struct EngineFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1793 | pub kind: EngineErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1794 | pub message: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1795 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1796 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1797 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1798 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1799 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1800 | pub enum EngineErrorKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1801 | EventReceiverClosed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1802 | Watcher, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1803 | Other, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1804 | } |