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