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