e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1 | use std::{collections::BTreeMap, 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), |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 26 | EventContext(EventContextCommand), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 27 | Mentions(crate::MentionsCommand), |
c9effeac326a | atagen | 2026-10-25 10:32 UTC | 28 | Search(crate::SearchCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 29 | Media(MediaCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 30 | Encryption(EncryptionCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 31 | Notification(NotificationCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 32 | Lifecycle(LifecycleCommand), |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 33 | Pack(PackCommand), |
80381e06a573 | atagen | 2026-10-25 03:02 UTC | 34 | HistoryRepair(crate::HistoryRepairCommand), |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 35 | ThreadList(ThreadListCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 36 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 37 | |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 38 | #[derive(Clone, Debug, Eq, PartialEq)] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 39 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 40 | #[non_exhaustive] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 41 | pub enum EventContextCommand { |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 42 | /// opens a session that owns the media of everything it hands out. at most 32 stay |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 43 | /// open, opening another closes the oldest, and leaving the room closes its sessions, |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 44 | /// both told with `Event::EventContextClosed` |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 45 | Fetch { |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 46 | room_id: OwnedRoomId, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 47 | event_id: OwnedEventId, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 48 | before_limit: u16, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 49 | after_limit: u16, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 50 | }, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 51 | Before { |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 52 | context_id: String, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 53 | limit: u16, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 54 | token: String, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 55 | }, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 56 | After { |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 57 | context_id: String, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 58 | limit: u16, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 59 | token: String, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 60 | }, |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 61 | /// frees the session's media. its rows' media ids stop resolving |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 62 | Close { context_id: String }, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 63 | } |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 64 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 65 | #[derive(Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 66 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 67 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 68 | pub enum AccountCommand { |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 69 | /// removes `remove_pushers` first, best effort, while the token still works. pushers belong |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 70 | /// to the user rather than the device, so only the caller knows which are this browser's |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 71 | Logout { |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 72 | remove_pushers: Vec<PusherKey>, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 73 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 74 | SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 75 | event_type: GlobalAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 76 | content: Raw<AnyGlobalAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 77 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 78 | SetDisplayName(Option<String>), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 79 | SetAvatar(Option<OwnedMxcUri>), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 80 | /// uploads the image and points the profile at it, same byte cap as any upload |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 81 | UploadAvatar { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 82 | mimetype: String, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 83 | bytes: Vec<u8>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 84 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 85 | /// unencrypted, answers with `CommandOutput::Mxc`. same byte cap as any upload |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 86 | UploadMedia { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 87 | mimetype: String, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 88 | bytes: Vec<u8>, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 89 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 90 | IgnoreUser(OwnedUserId), |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 91 | UnignoreUser(OwnedUserId), |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 92 | /// writes msc3230 orders so these spaces sort in exactly this sequence, touching as few as it can |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 93 | ReorderSpaces(Vec<OwnedRoomId>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 94 | RenameDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 95 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 96 | display_name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 97 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 98 | DeleteDevices { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 99 | device_ids: Vec<OwnedDeviceId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 100 | auth: Option<crate::InteractiveAuth>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 101 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 102 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 103 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 104 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 105 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 106 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 107 | pub enum RoomCommand { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 108 | /// the snapshot turns up as `Event::TimelineReset`. opening an open room sends a fresh one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 109 | Open(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 110 | Close(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 111 | Join { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 112 | room: OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 113 | via: Vec<OwnedServerName>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 114 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 115 | Leave(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 116 | Forget(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 117 | AcceptInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 118 | RejectInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 119 | InviteUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 120 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 121 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 122 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 123 | KickUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 124 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 125 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 126 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 127 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 128 | BanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 129 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 130 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 131 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 132 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 133 | UnbanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 134 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 135 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 136 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 137 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 138 | SetPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 139 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 140 | changes: PowerLevelChanges, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 141 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 142 | SetUserPowerLevel { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 143 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 144 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 145 | level: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 146 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 147 | /// muting drops them below what sending a message takes, unmuting puts a muted user back |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 148 | /// at users_default and leaves anyone else alone |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 149 | MuteUser { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 150 | room_id: OwnedRoomId, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 151 | user_id: OwnedUserId, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 152 | muted: bool, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 153 | }, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 154 | /// pinning appends, so the newest pin is last like everywhere else |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 155 | SetPinned { |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 156 | room_id: OwnedRoomId, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 157 | event_id: OwnedEventId, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 158 | pinned: bool, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 159 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 160 | /// adding m.favourite drops m.lowpriority, the way Element does |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 161 | SetFavourite { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 162 | room_id: OwnedRoomId, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 163 | favourite: bool, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 164 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 165 | /// your name in one room. None goes back to your global name |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 166 | SetOwnDisplayName { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 167 | room_id: OwnedRoomId, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 168 | name: Option<String>, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 169 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 170 | /// your avatar in one room. None goes back to your global avatar |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 171 | SetOwnAvatar { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 172 | room_id: OwnedRoomId, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 173 | avatar: Option<OwnedMxcUri>, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 174 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 175 | Create(CreateRoomOptions), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 176 | /// hands back the existing dm if there is one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 177 | CreateDirect(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 178 | CancelSend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 179 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 180 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 181 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 182 | RetrySend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 183 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 184 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 185 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 186 | SetTyping { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 187 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 188 | typing: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 189 | }, |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 190 | /// the key work a send into an encrypted room would otherwise start with, done now. |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 191 | /// nothing in a plain room, and a second ask joins the first |
38c4caecdb3d | atagen | 2026-09-26 13:35 UTC | 192 | PrepareToSend(OwnedRoomId), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 193 | SetAccountData { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 194 | room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 195 | event_type: RoomAccountDataEventType, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 196 | content: Raw<AnyRoomAccountDataEventContent>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 197 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 198 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 199 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 200 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 201 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 202 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 203 | pub struct CreateRoomOptions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 204 | pub name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 205 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 206 | pub alias_localpart: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 207 | pub invite: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 208 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 209 | pub visibility: RoomVisibility, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 210 | pub preset: Option<RoomPreset>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 211 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 212 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 213 | impl CreateRoomOptions { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 214 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 215 | pub fn with_name(mut self, name: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 216 | self.name = Some(name.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 217 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 218 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 219 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 220 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 221 | pub fn with_topic(mut self, topic: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 222 | self.topic = Some(topic.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 223 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 224 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 225 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 226 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 227 | pub fn with_alias_localpart(mut self, localpart: impl Into<String>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 228 | self.alias_localpart = Some(localpart.into()); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 229 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 230 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 231 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 232 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 233 | pub fn with_invite(mut self, invite: impl IntoIterator<Item = OwnedUserId>) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 234 | self.invite = invite.into_iter().collect(); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 235 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 236 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 237 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 238 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 239 | pub const fn with_direct(mut self, direct: bool) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 240 | self.direct = direct; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 241 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 242 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 243 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 244 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 245 | pub const fn with_visibility(mut self, visibility: RoomVisibility) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 246 | self.visibility = visibility; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 247 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 248 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 249 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 250 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 251 | pub const fn with_preset(mut self, preset: RoomPreset) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 252 | self.preset = Some(preset); |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 253 | self |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 254 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 255 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 256 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 257 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 258 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 259 | pub enum RoomVisibility { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 260 | #[default] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 261 | Private, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 262 | Public, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 263 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 264 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 265 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 266 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 267 | pub enum RoomPreset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 268 | PrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 269 | TrustedPrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 270 | PublicChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 271 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 272 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 273 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 274 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 275 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 276 | pub enum TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 277 | OpenThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 278 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 279 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 280 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 281 | CloseThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 282 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 283 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 284 | }, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 285 | /// the room's pinned events as a timeline of their own, kept current as pins change. |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 286 | /// it can't send or paginate, the pins are all it holds |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 287 | OpenPinned(OwnedRoomId), |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 288 | ClosePinned(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 289 | /// Re-emit an authoritative reset for an open room or thread without |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 290 | /// closing it. The reset arrives before this command's terminal result. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 291 | Resync { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 292 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 293 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 294 | Paginate { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 295 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 296 | limit: u16, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 297 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 298 | Send { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 299 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 300 | content: MessageContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 301 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 302 | Edit { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 303 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 304 | target: EventRef, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 305 | content: MessageEditContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 306 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 307 | /// redacting your own unsent message just cancels it |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 308 | Redact { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 309 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 310 | target: EventRef, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 311 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 312 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 313 | ToggleReaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 314 | timeline_id: TimelineId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 315 | target: EventRef, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 316 | key: String, |
8fa8a7cde89c | atagen | 2026-10-08 12:39 UTC | 317 | /// a custom emote's shortcode, sent along so clients without the pack can label it |
8fa8a7cde89c | atagen | 2026-10-08 12:39 UTC | 318 | shortcode: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 319 | }, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 320 | /// works on a closed room too, it just can't refuse to move the marker backwards |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 321 | MarkRead { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 322 | timeline_id: TimelineId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 323 | event_id: OwnedEventId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 324 | }, |
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 | impl TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 328 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 329 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 330 | match self { |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 331 | Self::OpenThread { room_id, .. } |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 332 | | Self::CloseThread { room_id, .. } |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 333 | | Self::OpenPinned(room_id) |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 334 | | Self::ClosePinned(room_id) => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 335 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 336 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 337 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 338 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 339 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 340 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 341 | | Self::MarkRead { timeline_id, .. } => timeline_id.room_id(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 342 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 343 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 344 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 345 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 346 | pub const fn timeline_id(&self) -> Option<&TimelineId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 347 | match self { |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 348 | Self::OpenThread { .. } |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 349 | | Self::CloseThread { .. } |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 350 | | Self::OpenPinned(_) |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 351 | | Self::ClosePinned(_) => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 352 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 353 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 354 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 355 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 356 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 357 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 358 | | Self::MarkRead { timeline_id, .. } => Some(timeline_id), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 359 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 360 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 361 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 362 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 363 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 364 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 365 | pub enum TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 366 | Room(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 367 | Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 368 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 369 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 370 | }, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 371 | Pinned(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 372 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 373 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 374 | impl TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 375 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 376 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 377 | match self { |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 378 | Self::Room(room_id) | Self::Thread { room_id, .. } | Self::Pinned(room_id) => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 379 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 380 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 381 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 382 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 383 | pub fn thread(room_id: OwnedRoomId, root_event_id: OwnedEventId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 384 | Self::Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 385 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 386 | root_event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 387 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 388 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 389 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 390 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 391 | pub fn thread_root(&self) -> Option<&OwnedEventId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 392 | match self { |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 393 | Self::Room(_) | Self::Pinned(_) => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 394 | Self::Thread { root_event_id, .. } => Some(root_event_id), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 395 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 396 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 397 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 398 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 399 | impl From<OwnedRoomId> for TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 400 | fn from(room_id: OwnedRoomId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 401 | Self::Room(room_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 402 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 403 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 404 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 405 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 406 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 407 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 408 | pub enum MediaCommand { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 409 | /// succeeds once the send queue has it. progress and failure arrive as events |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 410 | Upload(AttachmentUpload), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 411 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 412 | |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 413 | /// a room's threads, newest activity first, kept current as they gain replies. the room |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 414 | /// needn't be open |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 415 | #[derive(Clone, Debug, Eq, PartialEq)] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 416 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 417 | #[non_exhaustive] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 418 | pub enum ThreadListCommand { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 419 | /// answers once `ThreadListReset` has gone out, empty until a page arrives. opening an |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 420 | /// open list sends a fresh reset |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 421 | Open(OwnedRoomId), |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 422 | /// the next `limit` threads from the server, at most 50. one page runs at a time and a |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 423 | /// second ask waits for it |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 424 | Paginate { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 425 | room_id: OwnedRoomId, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 426 | limit: u16, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 427 | }, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 428 | Close(OwnedRoomId), |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 429 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 430 | |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 431 | /// msc2545 pack editing. edits read the server's copy and keep keys macltok doesn't model |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 432 | #[derive(Clone, Debug, Eq, PartialEq)] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 433 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 434 | #[non_exhaustive] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 435 | pub enum PackCommand { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 436 | /// body defaults to the shortcode |
924b7c011591 | atagen | 2026-10-25 10:28 UTC | 437 | /// into a thread with the thread relation. the pinned timeline refuses it |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 438 | SendSticker { |
924b7c011591 | atagen | 2026-10-25 10:28 UTC | 439 | timeline_id: TimelineId, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 440 | pack_id: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 441 | shortcode: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 442 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 443 | /// fails if the state key already holds a pack |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 444 | CreateRoomPack { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 445 | room_id: OwnedRoomId, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 446 | state_key: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 447 | display_name: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 448 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 449 | /// empties the content, which is all deleting a pack can mean |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 450 | Delete(ImagePackSource), |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 451 | SetMeta { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 452 | pack: ImagePackSource, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 453 | display_name: Patch<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 454 | avatar: Patch<OwnedMxcUri>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 455 | usage: Patch<Vec<PackUsage>>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 456 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 457 | /// adds or replaces by shortcode. a replaced image keeps its info unless the url changed |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 458 | PutImage { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 459 | pack: ImagePackSource, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 460 | shortcode: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 461 | mxc: OwnedMxcUri, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 462 | body: Option<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 463 | usage: Option<Vec<PackUsage>>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 464 | info: Option<PackImageInfo>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 465 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 466 | /// fails if `to` is taken |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 467 | RenameImage { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 468 | pack: ImagePackSource, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 469 | from: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 470 | to: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 471 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 472 | RemoveImage { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 473 | pack: ImagePackSource, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 474 | shortcode: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 475 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 476 | SetEnabledEverywhere { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 477 | room_id: OwnedRoomId, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 478 | state_key: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 479 | enabled: bool, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 480 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 481 | /// answers with `CommandOutput::Mxc`, the same uri when it already lives on your homeserver |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 482 | Rehost(OwnedMxcUri), |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 483 | /// the rest answer with `CommandOutput::Cloned`. clashes get `-2`, `-3` and so on |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 484 | CloneImage { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 485 | from_pack: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 486 | shortcode: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 487 | to: ImagePackSource, |
2656c1d26d6b | atagen | 2026-10-25 05:44 UTC | 488 | usage: Option<Vec<PackUsage>>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 489 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 490 | CloneSticker { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 491 | room_id: OwnedRoomId, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 492 | event_id: OwnedEventId, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 493 | to: ImagePackSource, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 494 | shortcode: String, |
2656c1d26d6b | atagen | 2026-10-25 05:44 UTC | 495 | usage: Option<Vec<PackUsage>>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 496 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 497 | /// makes the room pack if its state key is free, else merges. images that can't be |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 498 | /// fetched are skipped and listed, the rest are written |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 499 | ClonePack { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 500 | from_pack: String, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 501 | to: ImagePackSource, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 502 | display_name: Option<String>, |
2656c1d26d6b | atagen | 2026-10-25 05:44 UTC | 503 | usage: Option<Vec<PackUsage>>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 504 | }, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 505 | } |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 506 | |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 507 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 508 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 509 | pub enum Patch<T> { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 510 | #[default] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 511 | Keep, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 512 | Clear, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 513 | Set(T), |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 514 | } |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 515 | |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 516 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 517 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 518 | #[non_exhaustive] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 519 | pub struct PackImageInfo { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 520 | pub mimetype: Option<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 521 | pub size_bytes: Option<u64>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 522 | pub width: Option<u64>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 523 | pub height: Option<u64>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 524 | } |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 525 | |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 526 | impl PackImageInfo { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 527 | #[must_use] |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 528 | pub fn new( |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 529 | mimetype: Option<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 530 | size_bytes: Option<u64>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 531 | width: Option<u64>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 532 | height: Option<u64>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 533 | ) -> Self { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 534 | Self { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 535 | mimetype, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 536 | size_bytes, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 537 | width, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 538 | height, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 539 | } |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 540 | } |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 541 | } |
fa51490b6ae9 | atagen | 2026-10-24 08:41 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))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 545 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 546 | pub struct AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 547 | pub timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 548 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 549 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 550 | pub bytes: Vec<u8>, |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 551 | pub caption: Option<RichText>, |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 552 | pub mentions: MessageMentions, |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 553 | pub reply_to: Option<OwnedEventId>, |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 554 | pub notify_replied_to: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 555 | pub details: Option<UploadDetails>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 556 | pub thumbnail: Option<UploadThumbnail>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 557 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 558 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 559 | impl AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 560 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 561 | pub fn new( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 562 | timeline_id: impl Into<TimelineId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 563 | filename: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 564 | mimetype: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 565 | bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 566 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 567 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 568 | timeline_id: timeline_id.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 569 | filename: filename.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 570 | mimetype: mimetype.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 571 | bytes, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 572 | caption: None, |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 573 | mentions: MessageMentions::default(), |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 574 | reply_to: None, |
0827ad2d24e9 | atagen | 2026-10-23 06:49 UTC | 575 | notify_replied_to: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 576 | details: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 577 | thumbnail: None, |
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 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 581 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 582 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 583 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 584 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 585 | pub enum UploadDetails { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 586 | Image { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 587 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 588 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 589 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 590 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 591 | Video { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 592 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 593 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 594 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 595 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 596 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 597 | Audio { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 598 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 599 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 600 | Voice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 601 | duration_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 602 | waveform: Vec<u16>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 603 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 604 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 605 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 606 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 607 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 608 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 609 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 610 | pub struct UploadThumbnail { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 611 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 612 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 613 | pub width: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 614 | pub height: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 615 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 616 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 617 | impl UploadThumbnail { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 618 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 619 | pub fn new(bytes: Vec<u8>, mimetype: impl Into<String>, width: u32, height: u32) -> Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 620 | Self { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 621 | bytes, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 622 | mimetype: mimetype.into(), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 623 | width, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 624 | height, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 625 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 626 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 627 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 628 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 629 | #[derive(Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 630 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 631 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 632 | pub enum EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 633 | Recover(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 634 | CreateKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 635 | EnableKeyBackup, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 636 | DisableKeyBackup { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 637 | delete_from_server: bool, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 638 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 639 | RecoverKeyBackup(String), |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 640 | /// creates secret storage holding the cross-signing and backup keys, turns key backup on, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 641 | /// and answers with the recovery key. refused while a backup this device can't open exists |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 642 | EnableRecovery { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 643 | passphrase: Option<String>, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 644 | }, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 645 | ResetRecoveryKey { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 646 | passphrase: Option<String>, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 647 | }, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 648 | DisableRecovery, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 649 | StartVerification(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 650 | Verify(VerificationAction), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 651 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 652 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 653 | impl fmt::Debug for EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 654 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 655 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 656 | Self::Recover(_) => formatter.debug_tuple("Recover").field(&"...").finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 657 | Self::CreateKeyBackup => formatter.write_str("CreateKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 658 | Self::EnableKeyBackup => formatter.write_str("EnableKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 659 | Self::DisableKeyBackup { delete_from_server } => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 660 | .debug_struct("DisableKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 661 | .field("delete_from_server", delete_from_server) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 662 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 663 | Self::RecoverKeyBackup(_) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 664 | .debug_tuple("RecoverKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 665 | .field(&"...") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 666 | .finish(), |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 667 | Self::EnableRecovery { passphrase } => formatter |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 668 | .debug_struct("EnableRecovery") |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 669 | .field("passphrase", &passphrase.as_ref().map(|_| "...")) |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 670 | .finish(), |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 671 | Self::ResetRecoveryKey { passphrase } => formatter |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 672 | .debug_struct("ResetRecoveryKey") |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 673 | .field("passphrase", &passphrase.as_ref().map(|_| "...")) |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 674 | .finish(), |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 675 | Self::DisableRecovery => formatter.write_str("DisableRecovery"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 676 | Self::StartVerification(target) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 677 | .debug_tuple("StartVerification") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 678 | .field(target) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 679 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 680 | Self::Verify(action) => formatter.debug_tuple("Verify").field(action).finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 681 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 682 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 683 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 684 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 685 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 686 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 687 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 688 | pub enum NotificationCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 689 | SetRoomMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 690 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 691 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 692 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 693 | ResetRoomMode(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 694 | SetDefaultMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 695 | encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 696 | one_to_one: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 697 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 698 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 699 | AddKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 700 | RemoveKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 701 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 702 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 703 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 704 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 705 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 706 | pub enum LifecycleCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 707 | Shutdown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 708 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 709 | |
80381e06a573 | atagen | 2026-10-25 03:02 UTC | 710 | #[derive(Clone, Debug, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 711 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 712 | pub enum CommandOutput { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 713 | Done, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 714 | Room(OwnedRoomId), |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 715 | Mxc(OwnedMxcUri), |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 716 | /// the shortcodes the copies ended up under, and the ones that couldn't be fetched |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 717 | Cloned { |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 718 | shortcodes: Vec<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 719 | skipped: Vec<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 720 | }, |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 721 | EventContext(EventContextSession), |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 722 | EventContextPage(EventContextPage), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 723 | MentionsPage(crate::MentionsPage), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 724 | MentionContext(crate::SavedMentionContext), |
c9effeac326a | atagen | 2026-10-25 10:32 UTC | 725 | SearchSession(crate::SearchSession), |
c9effeac326a | atagen | 2026-10-25 10:32 UTC | 726 | SearchPage(crate::SearchPage), |
c9effeac326a | atagen | 2026-10-25 10:32 UTC | 727 | SearchCoverage(crate::SearchCoverage), |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 728 | RecoveryKey(RecoveryKey), |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 729 | } |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 730 | |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 731 | #[derive(Clone, Debug, Eq, PartialEq)] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 732 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 733 | #[non_exhaustive] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 734 | pub struct EventContext { |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 735 | pub events_before: Vec<TimelineItem>, |
cb7b3362e1ce | atagen | 2026-10-25 09:08 UTC | 736 | pub event: TimelineItem, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 737 | pub events_after: Vec<TimelineItem>, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 738 | pub start_token: Option<String>, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 739 | pub end_token: Option<String>, |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 740 | } |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 741 | |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 742 | #[derive(Clone, Debug, Eq, PartialEq)] |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 743 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 744 | pub enum EventContextCloseReason { |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 745 | /// opening a 33rd session closed the oldest |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 746 | Evicted, |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 747 | RoomLeft, |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 748 | } |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 749 | |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 750 | /// a session's media stay resolvable until it closes, and past `EngineConfig::max_context_media` |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 751 | /// its least recently used are dropped |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 752 | #[derive(Clone, Debug, Eq, PartialEq)] |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 753 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 754 | #[non_exhaustive] |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 755 | pub struct EventContextSession { |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 756 | pub context_id: String, |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 757 | pub context: EventContext, |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 758 | } |
da8896938cf0 | atagen | 2026-10-25 10:04 UTC | 759 | |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 760 | #[derive(Clone, Debug, Eq, PartialEq)] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 761 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 762 | #[non_exhaustive] |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 763 | pub struct EventContextPage { |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 764 | pub events: Vec<TimelineItem>, |
cb7b3362e1ce | atagen | 2026-10-25 09:08 UTC | 765 | /// `None` once that end of the room is reached |
89bc9f8d246d | atagen | 2026-10-24 13:40 UTC | 766 | pub next_token: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 767 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 768 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 769 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 770 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 771 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 772 | pub enum MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 773 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 774 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 775 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 776 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 777 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 778 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 779 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 780 | }, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 781 | /// m.notice, for bots. clients render it muted and never answer it automatically |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 782 | Notice { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 783 | content: RichText, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 784 | mentions: MessageMentions, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 785 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 786 | Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 787 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 788 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 789 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 790 | notify_replied_to: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 791 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 792 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 793 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 794 | impl MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 795 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 796 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 797 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 798 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 799 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 800 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 801 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 802 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 803 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 804 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 805 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 806 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 807 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 808 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 809 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 810 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 811 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 812 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 813 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 814 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 815 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 816 | #[must_use] |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 817 | pub fn notice(content: RichText, mentions: MessageMentions) -> Self { |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 818 | Self::Notice { content, mentions } |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 819 | } |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 820 | |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 821 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 822 | pub fn reply(event_id: OwnedEventId, content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 823 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 824 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 825 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 826 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 827 | notify_replied_to: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 828 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 829 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 830 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 831 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 832 | pub fn reply_without_notification( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 833 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 834 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 835 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 836 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 837 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 838 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 839 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 840 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 841 | notify_replied_to: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 842 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 843 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 844 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 845 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 846 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 847 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 848 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 849 | pub enum MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 850 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 851 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 852 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 853 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 854 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 855 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 856 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 857 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 858 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 859 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 860 | impl MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 861 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 862 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 863 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 864 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 865 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 866 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 867 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 868 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 869 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 870 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 871 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 872 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 873 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 874 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 875 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 876 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 877 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 878 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 879 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 880 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 881 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 882 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 883 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 884 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 885 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 886 | pub struct RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 887 | pub body: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 888 | pub formatted_body: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 889 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 890 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 891 | impl RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 892 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 893 | pub fn plain(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 894 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 895 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 896 | formatted_body: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 897 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 898 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 899 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 900 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 901 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 902 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 903 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 904 | formatted_body: Some(formatted_body.into()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 905 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 906 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 907 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 908 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 909 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 910 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 911 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 912 | pub struct MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 913 | pub user_ids: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 914 | pub room: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 915 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 916 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 917 | impl MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 918 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 919 | pub fn with_user_ids(user_ids: impl IntoIterator<Item = OwnedUserId>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 920 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 921 | user_ids: user_ids.into_iter().collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 922 | room: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 923 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 924 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 925 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 926 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 927 | pub fn room() -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 928 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 929 | user_ids: Vec::new(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 930 | room: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 931 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 932 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 933 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 934 | |
80381e06a573 | atagen | 2026-10-25 03:02 UTC | 935 | #[derive(Clone, Debug, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 936 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 937 | pub enum Event { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 938 | ConnectionChanged(ConnectionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 939 | Authenticated { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 940 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 941 | }, |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 942 | /// the tokens rotated. with a `SessionStore` the record is already saved by now, |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 943 | /// without one persist a fresh `ClientHandle::session_record()` atomically |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 944 | SessionTokensChanged, |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 945 | /// the rotated tokens didn't reach the `SessionStore`, so the saved record may not |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 946 | /// restore. the engine tries again on the next rotation |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 947 | SessionSaveFailed { |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 948 | message: String, |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 949 | }, |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 950 | /// the server stopped honouring our token and the engine stops. a soft logout |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 951 | /// names the device to log in again as, keeping the store. otherwise the record |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 952 | /// and the store are both dead |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 953 | SessionAccessRejected { |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 954 | soft_logout: Option<OwnedDeviceId>, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 955 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 956 | NotificationSettingsChanged, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 957 | VerificationTargetChanged(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 958 | RoomsChanged, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 959 | MentionsChanged(crate::MentionsUpdate), |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 960 | /// an image pack came, went or changed somewhere. ask `image_packs` again |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 961 | ImagePacksChanged, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 962 | /// replaces whatever you had for this timeline. every diff after it applies to it |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 963 | TimelineReset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 964 | timeline_id: TimelineId, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 965 | items: Vector<TimelineItem>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 966 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 967 | TimelineChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 968 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 969 | diffs: Vec<TimelineDiff>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 970 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 971 | HistoryChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 972 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 973 | state: HistoryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 974 | }, |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 975 | RecentHistoryChanged { |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 976 | room_id: OwnedRoomId, |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 977 | state: RecentHistoryState, |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 978 | }, |
80381e06a573 | atagen | 2026-10-25 03:02 UTC | 979 | HistoryRepairChanged(crate::HistoryRepairReport), |
80381e06a573 | atagen | 2026-10-25 03:02 UTC | 980 | #[doc(hidden)] |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 981 | PublicationBarrier { |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 982 | #[cfg_attr(feature = "serde", serde(skip))] |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 983 | acknowledgement: Option<crate::PublicationAck>, |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 984 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 985 | /// the timeline was closed, or its room was left, and nothing more comes for it |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 986 | /// until another `TimelineReset` |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 987 | TimelineClosed { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 988 | timeline_id: TimelineId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 989 | }, |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 990 | /// an event context closed by something other than its own `Close`. its id answers |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 991 | /// `EventContextNotOpen` from now on |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 992 | EventContextClosed { |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 993 | context_id: String, |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 994 | reason: EventContextCloseReason, |
1f875b103b27 | atagen | 2026-10-25 10:44 UTC | 995 | }, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 996 | /// replaces whatever you had for this room's thread list, newest activity first |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 997 | ThreadListReset { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 998 | room_id: OwnedRoomId, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 999 | entries: Vector<ThreadListEntry>, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1000 | }, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1001 | /// apply each with `ThreadListEntry::upsert` |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1002 | ThreadListChanged { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1003 | room_id: OwnedRoomId, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1004 | upserts: Vec<ThreadListEntry>, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1005 | }, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1006 | /// `StartReached` once the oldest thread is in |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1007 | ThreadListHistoryChanged { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1008 | room_id: OwnedRoomId, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1009 | state: HistoryState, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1010 | }, |
74befbc72baf | atagen | 2026-10-25 11:18 UTC | 1011 | /// a search closed by something other than its own `Close`. its id answers |
74befbc72baf | atagen | 2026-10-25 11:18 UTC | 1012 | /// `SearchNotOpen` from now on |
74befbc72baf | atagen | 2026-10-25 11:18 UTC | 1013 | SearchClosed { |
74befbc72baf | atagen | 2026-10-25 11:18 UTC | 1014 | search_id: String, |
74befbc72baf | atagen | 2026-10-25 11:18 UTC | 1015 | reason: crate::SearchCloseReason, |
74befbc72baf | atagen | 2026-10-25 11:18 UTC | 1016 | }, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1017 | /// nothing more comes for it until another `ThreadListReset` |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1018 | ThreadListClosed { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1019 | room_id: OwnedRoomId, |
60454002af5f | atagen | 2026-10-25 11:13 UTC | 1020 | reason: ThreadListCloseReason, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1021 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1022 | /// a room that stops being watched says so with an empty `users` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1023 | TypingChanged(TypingState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1024 | MediaUploadProgress { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1025 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1026 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1027 | uploaded_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1028 | total_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1029 | complete: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1030 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1031 | /// not the end of it. `will_retry` means the send queue has another go by itself, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1032 | /// otherwise it waits for `retry_send` or `cancel_send` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1033 | MediaUploadFailed { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1034 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1035 | transaction_id: OwnedTransactionId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1036 | kind: crate::ErrorKind, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1037 | will_retry: bool, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1038 | }, |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 1039 | /// an upload that turned up in a progress or failure event gets exactly one of |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 1040 | /// these while the engine runs, and nothing about it after. stopping ends |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 1041 | /// nothing, `Stopped` covers whatever is still going and the sdk resumes it next run |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1042 | MediaUploadFinished { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1043 | room_id: OwnedRoomId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1044 | transaction_id: OwnedTransactionId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1045 | outcome: UploadOutcome, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1046 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1047 | EncryptionChanged(EncryptionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1048 | VerificationChanged(VerificationState), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 1049 | /// logout went through and the engine stops. delete the record and the store |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1050 | LoggedOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1051 | Failed(EngineFailure), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 1052 | /// always the last event. keep the saved record unless `LoggedOut` or a |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1053 | /// hard `SessionAccessRejected` came first. commands still in flight answer `Interrupted` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1054 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1055 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1056 | |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1057 | #[derive(Clone, Debug, Eq, PartialEq)] |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1058 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1059 | pub enum UploadOutcome { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1060 | Sent { |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1061 | event_id: OwnedEventId, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1062 | }, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1063 | Cancelled, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1064 | /// its room was forgotten, and the queue with it |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1065 | RoomForgotten, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1066 | /// the sdk's update channel overflowed while it ended, so whether it was sent is unknown |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1067 | Missed, |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1068 | } |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 1069 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1070 | /// why `Engine::run` came back, when nothing went wrong |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1071 | #[derive(Clone, Debug, Eq, PartialEq)] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1072 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1073 | pub enum Termination { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1074 | ShutDown, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1075 | /// every `ClientHandle` was dropped, so nobody could have asked for anything else |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1076 | HandlesDropped, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1077 | LoggedOut, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1078 | /// the server rejected our token for good |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1079 | AccessRevoked, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1080 | /// 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 | 1081 | SoftLoggedOut { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1082 | device_id: OwnedDeviceId, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1083 | }, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1084 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1085 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1086 | impl Termination { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1087 | #[must_use] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1088 | pub const fn retain(&self) -> Retain { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1089 | match self { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1090 | Self::ShutDown | Self::HandlesDropped => Retain::RecordAndStore, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1091 | Self::SoftLoggedOut { .. } => Retain::Store, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1092 | Self::LoggedOut | Self::AccessRevoked => Retain::Nothing, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1093 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1094 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1095 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1096 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1097 | /// what's still worth keeping of the saved record and the store |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1098 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1099 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1100 | pub enum Retain { |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1101 | RecordAndStore, |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 1102 | /// keep the store and a record naming the device to log in again as |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1103 | Store, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1104 | Nothing, |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1105 | } |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 1106 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1107 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1108 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1109 | pub enum ConnectionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1110 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1111 | Connecting, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1112 | Online, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1113 | Offline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1114 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1115 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1116 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1117 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1118 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1119 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1120 | pub struct RoomSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1121 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1122 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1123 | pub membership: RoomMembership, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1124 | /// the main timeline's, threads have theirs in `thread_unreads` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1125 | pub unread_messages: u64, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1126 | /// thread mentions included |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1127 | pub unread_mentions: u64, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1128 | /// unread events the push rules said to notify about, which is neither of the above. |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1129 | /// the main timeline's |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1130 | pub unread_notifications: u64, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1131 | /// threads with anything unread, by root |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1132 | pub thread_unreads: BTreeMap<OwnedEventId, ThreadUnread>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1133 | pub encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1134 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1135 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1136 | pub favourite: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1137 | pub low_priority: bool, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1138 | pub avatar: Option<MediaId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1139 | pub latest_event_timestamp_ms: Option<u64>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1140 | pub latest_event: Option<LatestEvent>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1141 | pub notification_mode: Option<RoomNotificationMode>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1142 | pub notification_mode_custom: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1143 | pub topic: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1144 | pub canonical_alias: Option<OwnedRoomAliasId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1145 | pub joined_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1146 | pub invited_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1147 | /// who a nameless room gets named after |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1148 | pub heroes: Vec<RoomHero>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1149 | /// set once the room has been upgraded, this is where everyone went |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1150 | pub successor: Option<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1151 | pub inviter: Option<OwnedUserId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1152 | /// joined spaces that list this room as a child |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1153 | pub parent_spaces: Vec<OwnedRoomId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1154 | /// for a space, the children it lists, joined or not |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1155 | pub children: Vec<OwnedRoomId>, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 1156 | /// a space's msc3230 order. ordered spaces sort first by (order, room id), the rest by room id |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 1157 | pub space_order: Option<String>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 1158 | /// you can send im.ponies.room_emotes here, so you can make and edit its packs |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 1159 | pub can_edit_packs: bool, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 1160 | /// m.room.pinned_events in order, the newest pin last |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 1161 | pub pinned_events: Vec<OwnedEventId>, |
fa5b4e09943a | atagen | 2026-10-24 09:33 UTC | 1162 | pub can_pin: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1163 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1164 | |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1165 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1166 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1167 | #[non_exhaustive] |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1168 | pub struct ThreadUnread { |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1169 | pub messages: u64, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1170 | pub mentions: u64, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1171 | pub notifications: u64, |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1172 | } |
e5c6427adb35 | atagen | 2026-10-25 10:23 UTC | 1173 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1174 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1175 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1176 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1177 | pub struct RoomHero { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1178 | pub user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1179 | pub display_name: Option<String>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1180 | pub avatar: Option<MediaId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1181 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1182 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1183 | /// enough for a room list preview line. `kind` and `body` are only set for messages, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1184 | /// and an edit shows its new text |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1185 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1186 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1187 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1188 | pub struct LatestEvent { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1189 | pub sender: Option<OwnedUserId>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1190 | pub kind: Option<MessageKind>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1191 | pub body: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1192 | pub timestamp_ms: Option<u64>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1193 | pub send_state: SendState, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1194 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1195 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1196 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1197 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1198 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1199 | pub struct Profile { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1200 | pub user_id: OwnedUserId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1201 | pub display_name: Option<String>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1202 | pub avatar: Option<MediaId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1203 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1204 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1205 | /// 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 | 1206 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1207 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1208 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1209 | pub struct SpaceChild { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1210 | pub room_id: OwnedRoomId, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1211 | pub name: String, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1212 | pub topic: Option<String>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1213 | pub avatar: Option<MediaId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1214 | pub canonical_alias: Option<OwnedRoomAliasId>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1215 | pub joined_members: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1216 | pub space: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1217 | pub children_count: u64, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1218 | pub membership: Option<RoomMembership>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1219 | pub via: Vec<OwnedServerName>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1220 | pub suggested: bool, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1221 | pub world_readable: Option<bool>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1222 | pub guest_can_join: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1223 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1224 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1225 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1226 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1227 | pub enum RoomNotificationMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1228 | AllMessages, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1229 | MentionsAndKeywordsOnly, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1230 | Mute, |
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 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1234 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1235 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1236 | pub struct RoomNotificationSettings { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1237 | pub mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1238 | pub custom: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1239 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1240 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1241 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1242 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1243 | pub enum PushNotificationStatus { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1244 | Event(Box<PushNotification>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1245 | NotFound, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1246 | FilteredOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1247 | Redacted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1248 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1249 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1250 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1251 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1252 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1253 | pub struct PushNotification { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1254 | pub event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1255 | pub event: PushNotificationEvent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1256 | pub sender: PushNotificationSender, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1257 | pub room: PushNotificationRoom, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1258 | pub noisy: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1259 | pub has_mention: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1260 | pub thread_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1261 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1262 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1263 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1264 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1265 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1266 | pub struct PushNotificationSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1267 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1268 | pub display_name: Option<String>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1269 | pub avatar_url: Option<MediaId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1270 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1271 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1272 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1273 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1274 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1275 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1276 | pub struct PushNotificationRoom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1277 | pub room_id: OwnedRoomId, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 1278 | /// from this session's store, so `None` for a room it hasn't synced yet |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 1279 | pub unread_notifications: Option<u64>, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 1280 | pub unread_mentions: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1281 | pub name: String, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1282 | pub avatar_url: Option<MediaId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1283 | pub canonical_alias: Option<OwnedRoomAliasId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1284 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1285 | pub encrypted: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1286 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1287 | pub joined_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1288 | pub service_members: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1289 | pub active_service_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1290 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1291 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1292 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1293 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1294 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1295 | pub enum PushNotificationEvent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1296 | Timeline(Raw<AnySyncTimelineEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1297 | Invite(Raw<StrippedRoomMemberEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1298 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1299 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1300 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1301 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1302 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1303 | pub struct RoomPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1304 | pub ban: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1305 | pub invite: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1306 | pub kick: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1307 | pub redact: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1308 | pub events_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1309 | pub state_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1310 | pub users_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1311 | pub room_notification: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1312 | pub users: Vec<(OwnedUserId, i64)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1313 | pub events: Vec<(String, i64)>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1314 | /// in rooms from version 12 the creators outrank everyone and aren't listed in `users` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1315 | pub creators: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1316 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1317 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1318 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1319 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1320 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1321 | pub struct PowerLevelChanges { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1322 | pub ban: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1323 | pub invite: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1324 | pub kick: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1325 | pub redact: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1326 | pub events_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1327 | pub state_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1328 | pub users_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1329 | pub room_notification: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1330 | pub room_name: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1331 | pub room_avatar: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1332 | pub room_topic: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1333 | pub space_child: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1334 | pub beacon: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1335 | pub beacon_info: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1336 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1337 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1338 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1339 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1340 | pub enum RoomMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1341 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1342 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1343 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1344 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1345 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1346 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1347 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1348 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1349 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1350 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1351 | pub struct RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1352 | pub membership: Option<RoomMembership>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1353 | pub category: Option<RoomCategory>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1354 | pub favourite: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1355 | pub unread_only: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1356 | pub search: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1357 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1358 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1359 | impl RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1360 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1361 | pub fn with_membership(mut self, membership: RoomMembership) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1362 | self.membership = Some(membership); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1363 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1364 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1365 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1366 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1367 | pub fn with_category(mut self, category: RoomCategory) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1368 | self.category = Some(category); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1369 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1370 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1371 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1372 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1373 | pub fn with_favourite(mut self, favourite: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1374 | self.favourite = Some(favourite); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1375 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1376 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1377 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1378 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1379 | pub const fn with_unread_only(mut self, unread_only: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1380 | self.unread_only = unread_only; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1381 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1382 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1383 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1384 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1385 | pub fn with_search(mut self, search: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1386 | self.search = Some(search.into()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1387 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1388 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1389 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1390 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1391 | pub fn matches(&self, room: &RoomSummary) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1392 | self.matcher().matches(room) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1393 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1394 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1395 | /// lowercases the search once, for filtering a whole list |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1396 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1397 | pub fn matcher(&self) -> RoomMatcher<'_> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1398 | RoomMatcher { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1399 | filter: self, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1400 | search: self.search.as_deref().map(str::to_lowercase), |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1401 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1402 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1403 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1404 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1405 | #[derive(Debug)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1406 | pub struct RoomMatcher<'a> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1407 | filter: &'a RoomListFilter, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1408 | search: Option<String>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1409 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1410 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1411 | impl RoomMatcher<'_> { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1412 | #[must_use] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1413 | pub fn matches(&self, room: &RoomSummary) -> bool { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1414 | let filter = self.filter; |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1415 | filter |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1416 | .membership |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1417 | .is_none_or(|membership| room.membership == membership) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1418 | && filter.category.is_none_or(|category| match category { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1419 | RoomCategory::People => room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1420 | RoomCategory::Rooms => !room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1421 | RoomCategory::Spaces => room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1422 | }) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1423 | && filter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1424 | .favourite |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1425 | .is_none_or(|favourite| room.favourite == favourite) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1426 | && (!filter.unread_only || room.unread_messages > 0 || room.unread_mentions > 0) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1427 | && self.search.as_ref().is_none_or(|search| { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1428 | room.name.to_lowercase().contains(search) |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 1429 | || room.room_id.as_str().to_lowercase().contains(search) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1430 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1431 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1432 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1433 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1434 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1435 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1436 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1437 | pub enum RoomCategory { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1438 | People, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1439 | Rooms, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1440 | Spaces, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1441 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1442 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1443 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1444 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1445 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1446 | pub enum MemberFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1447 | Active, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1448 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1449 | Invited, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1450 | Banned, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1451 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1452 | All, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1453 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1454 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1455 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1456 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1457 | pub enum MemberMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1458 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1459 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1460 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1461 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1462 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1463 | Custom(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1464 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1465 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1466 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1467 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1468 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1469 | pub struct MemberSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1470 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1471 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1472 | pub display_name: Option<String>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1473 | pub avatar: Option<MediaId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1474 | pub membership: MemberMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1475 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1476 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1477 | pub ignored: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1478 | pub service: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1479 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1480 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1481 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1482 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1483 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1484 | pub struct OwnDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1485 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1486 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1487 | pub last_seen_ip: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1488 | pub last_seen_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1489 | pub current: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1490 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1491 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1492 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1493 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1494 | pub enum TimelineItem { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1495 | Event(Box<TimelineEvent>), |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 1496 | HistoryGap(crate::HistoryGap), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1497 | DayDivider { timestamp_ms: u64 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1498 | ReadMarker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1499 | TimelineStart, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1500 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1501 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1502 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1503 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1504 | pub enum TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1505 | Append { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1506 | Clear, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1507 | PushFront { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1508 | PushBack { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1509 | PopFront, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1510 | PopBack, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1511 | Insert { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1512 | Set { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1513 | Remove { index: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1514 | Truncate { length: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1515 | Reset { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1516 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1517 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1518 | #[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1519 | #[error("timeline diff is incompatible with the current {length}-item snapshot")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1520 | pub struct TimelineDiffError { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1521 | pub length: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1522 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1523 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1524 | impl TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1525 | /// Apply a diff only when its indices match the current snapshot. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1526 | /// On error the snapshot is unchanged; request `TimelineCommand::Resync` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1527 | /// and ignore further diffs until the corresponding `TimelineReset`. |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1528 | pub fn try_apply(self, items: &mut Vector<TimelineItem>) -> Result<(), TimelineDiffError> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1529 | let length = items.len(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1530 | if self.length_after(length).is_none() { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1531 | return Err(TimelineDiffError { length }); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1532 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1533 | self.apply(items); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1534 | Ok(()) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1535 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1536 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1537 | /// a whole `TimelineChanged` or none of it. whether a diff fits depends only on the |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1538 | /// length before it, so the batch is checked against lengths alone before anything |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1539 | /// moves. the error carries the length the snapshot would have had at the misfit |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1540 | pub fn try_apply_all( |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1541 | diffs: Vec<Self>, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1542 | items: &mut Vector<TimelineItem>, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1543 | ) -> Result<(), TimelineDiffError> { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1544 | diffs.iter().try_fold(items.len(), |length, diff| { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1545 | diff.length_after(length) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1546 | .ok_or(TimelineDiffError { length }) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1547 | })?; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1548 | for diff in diffs { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1549 | diff.apply(items); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1550 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1551 | Ok(()) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1552 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1553 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1554 | fn length_after(&self, length: usize) -> Option<usize> { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1555 | match self { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1556 | Self::Append { values } => Some(length + values.len()), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1557 | Self::Clear => Some(0), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1558 | Self::PushFront { .. } | Self::PushBack { .. } => Some(length + 1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1559 | Self::PopFront | Self::PopBack => length.checked_sub(1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1560 | Self::Insert { index, .. } => (*index <= length).then_some(length + 1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1561 | Self::Set { index, .. } => (*index < length).then_some(length), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1562 | Self::Remove { index } => (*index < length).then(|| length - 1), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1563 | Self::Truncate { length: target } => (*target <= length).then_some(*target), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1564 | Self::Reset { values } => Some(values.len()), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1565 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1566 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1567 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1568 | fn apply(self, items: &mut Vector<TimelineItem>) { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1569 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1570 | Self::Append { values } => items.extend(values), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1571 | Self::Clear => items.clear(), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1572 | Self::PushFront { value } => items.push_front(value), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1573 | Self::PushBack { value } => items.push_back(value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1574 | Self::PopFront => { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1575 | items.pop_front(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1576 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1577 | Self::PopBack => { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1578 | items.pop_back(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1579 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1580 | Self::Insert { index, value } => items.insert(index, value), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1581 | Self::Set { index, value } => { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1582 | items.set(index, value); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1583 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1584 | Self::Remove { index } => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1585 | items.remove(index); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1586 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1587 | Self::Truncate { length } => items.truncate(length), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1588 | Self::Reset { values } => *items = values.into_iter().collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1589 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1590 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1591 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1592 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1593 | #[cfg(test)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1594 | mod tests { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1595 | use imbl::{Vector, vector}; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1596 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1597 | use super::{TimelineDiff, TimelineItem}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1598 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1599 | fn item(timestamp_ms: u64) -> TimelineItem { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1600 | TimelineItem::DayDivider { timestamp_ms } |
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 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1604 | fn timeline_diff_try_apply_handles_every_variant() { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1605 | let mut items = vector![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1606 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1607 | TimelineDiff::Append { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1608 | values: vec![item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1609 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1610 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1611 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1612 | assert_eq!(items, vector![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1613 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1614 | TimelineDiff::Clear.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1615 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1616 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1617 | TimelineDiff::PushFront { value: item(2) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1618 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1619 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1620 | TimelineDiff::PushBack { value: item(3) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1621 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1622 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1623 | assert_eq!(items, vector![item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1624 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1625 | TimelineDiff::PopFront.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1626 | TimelineDiff::PopBack.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1627 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1628 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1629 | TimelineDiff::Reset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1630 | values: vec![item(1), item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1631 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1632 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1633 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1634 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1635 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1636 | value: item(2), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1637 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1638 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1639 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1640 | assert_eq!(items, vector![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1641 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1642 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1643 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1644 | value: item(4), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1645 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1646 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1647 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1648 | assert_eq!(items, vector![item(1), item(4), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1649 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1650 | TimelineDiff::Remove { index: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1651 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1652 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1653 | assert_eq!(items, vector![item(1), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1654 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1655 | TimelineDiff::Truncate { length: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1656 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1657 | .unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1658 | assert_eq!(items, vector![item(1)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1659 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1660 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1661 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1662 | fn invalid_timeline_diff_leaves_snapshot_unchanged() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1663 | let invalid = [ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1664 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1665 | index: 3, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1666 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1667 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1668 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1669 | index: 2, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1670 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1671 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1672 | TimelineDiff::Remove { index: 2 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1673 | TimelineDiff::Truncate { length: 3 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1674 | ]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1675 | for diff in invalid { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1676 | let mut items = vector![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1677 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 2); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1678 | assert_eq!(items, vector![item(1), item(2)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1679 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1680 | for diff in [TimelineDiff::PopFront, TimelineDiff::PopBack] { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1681 | let mut items = Vector::new(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1682 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1683 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1684 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1685 | } |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1686 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1687 | #[test] |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1688 | fn a_batch_that_goes_wrong_halfway_changes_nothing() { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1689 | let mut items = vector![item(1), item(2)]; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1690 | let batch = vec![ |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1691 | TimelineDiff::PushBack { value: item(3) }, |
0b8ce8dc9a1c | atagen | 2026-09-26 12:30 UTC | 1692 | TimelineDiff::PushBack { value: item(4) }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1693 | TimelineDiff::Remove { index: 0 }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1694 | TimelineDiff::Set { |
0b8ce8dc9a1c | atagen | 2026-09-26 12:30 UTC | 1695 | index: 3, |
0b8ce8dc9a1c | atagen | 2026-09-26 12:30 UTC | 1696 | value: item(5), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1697 | }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1698 | ]; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1699 | assert_eq!( |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1700 | TimelineDiff::try_apply_all(batch, &mut items) |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1701 | .unwrap_err() |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1702 | .length, |
0b8ce8dc9a1c | atagen | 2026-09-26 12:30 UTC | 1703 | 3 |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1704 | ); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1705 | assert_eq!(items, vector![item(1), item(2)]); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1706 | |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1707 | let batch = vec![ |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1708 | TimelineDiff::PushBack { value: item(3) }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1709 | TimelineDiff::Remove { index: 0 }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1710 | TimelineDiff::Set { |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1711 | index: 1, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1712 | value: item(4), |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1713 | }, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1714 | ]; |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1715 | TimelineDiff::try_apply_all(batch, &mut items).unwrap(); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1716 | assert_eq!(items, vector![item(2), item(4)]); |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 1717 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1718 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1719 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1720 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1721 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1722 | pub struct TimelineItemId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1723 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1724 | impl TimelineItemId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1725 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1726 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1727 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1728 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1729 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1730 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1731 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1732 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1733 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1734 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1735 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1736 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1737 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1738 | pub struct TimelineEvent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1739 | pub item_id: TimelineItemId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1740 | pub event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1741 | pub transaction_id: Option<OwnedTransactionId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1742 | pub sender: Sender, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1743 | pub timestamp_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1744 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1745 | pub send_state: SendState, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1746 | pub content: TimelineContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1747 | pub reply_to: Option<ReplyReference>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1748 | pub thread_root: Option<OwnedEventId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1749 | pub thread_summary: Option<ThreadSummary>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1750 | pub reactions: Vec<Reaction>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1751 | pub read_by: Vec<OwnedUserId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1752 | pub editable: bool, |
913832a327a8 | atagen | 2026-10-25 09:33 UTC | 1753 | /// the push rules ask for this one to stand out, always false for a local echo |
913832a327a8 | atagen | 2026-10-25 09:33 UTC | 1754 | pub highlight: bool, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1755 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1756 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1757 | impl TimelineEvent { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1758 | /// what to hand edit, redact and react. works before the server has echoed it back |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1759 | #[must_use] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1760 | pub fn target(&self) -> Option<EventRef> { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1761 | self.event_id |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1762 | .clone() |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1763 | .map(EventRef::Remote) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1764 | .or_else(|| self.transaction_id.clone().map(EventRef::Local)) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1765 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1766 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1767 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1768 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1769 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1770 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1771 | pub enum EventRef { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1772 | Remote(OwnedEventId), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1773 | /// a local echo, by the transaction id it was queued under |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1774 | Local(OwnedTransactionId), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1775 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1776 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1777 | impl From<OwnedEventId> for EventRef { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1778 | fn from(event_id: OwnedEventId) -> Self { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1779 | Self::Remote(event_id) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1780 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1781 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1782 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1783 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1784 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1785 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1786 | pub struct Sender { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1787 | pub user_id: OwnedUserId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1788 | pub display_name: Option<String>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1789 | pub avatar: Option<MediaId>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1790 | /// someone else in the room goes by the same name, so show the user id too |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1791 | pub name_ambiguous: bool, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1792 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1793 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1794 | impl Sender { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1795 | #[must_use] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1796 | pub fn name(&self) -> &str { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1797 | self.display_name |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1798 | .as_deref() |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1799 | .unwrap_or_else(|| self.user_id.as_str()) |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1800 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1801 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1802 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1803 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1804 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1805 | pub enum TimelineContent { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1806 | Message(Message), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1807 | Sticker { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1808 | body: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1809 | media: MediaDescriptor, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1810 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1811 | Poll { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1812 | question: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1813 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1814 | Redacted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1815 | UnableToDecrypt(UtdCause), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1816 | Membership { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1817 | user_id: OwnedUserId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1818 | display_name: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1819 | change: MembershipChange, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1820 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1821 | Profile { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1822 | user_id: OwnedUserId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1823 | display_name: Option<Change<Option<String>>>, |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1824 | avatar: Option<Change<Option<MediaId>>>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1825 | }, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1826 | /// `None` means it was cleared, or the event was redacted |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1827 | RoomName(Option<String>), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1828 | RoomTopic(Option<String>), |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 1829 | RoomAvatar(Option<MediaId>), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1830 | EncryptionEnabled, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1831 | RoomCreated, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1832 | RoomUpgraded { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1833 | successor: OwnedRoomId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1834 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1835 | OtherState { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1836 | event_type: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1837 | state_key: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1838 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1839 | Other { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1840 | event_type: String, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1841 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1842 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1843 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1844 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1845 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1846 | #[non_exhaustive] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1847 | pub struct Message { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1848 | pub kind: MessageKind, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1849 | pub body: String, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1850 | /// only for `MessageKind::Location` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 1851 | pub geo_uri: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1852 | pub formatted_body: Option<String>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1853 | pub mentions: Option<MessageMentions>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1854 | pub edited: bool, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1855 | pub media: Option<MediaDescriptor>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1856 | /// previews the sender attached (msc4095), so showing them asks no one about the url. |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1857 | /// one for a url the body doesn't contain is dropped |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1858 | pub link_previews: Vec<LinkPreview>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1859 | } |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1860 | |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1861 | /// a link card, from the sender's own message or from `ClientHandle::url_preview`. page |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1862 | /// text passes through whoever made it unfiltered, so it arrives trimmed to a sane length |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1863 | #[derive(Clone, Debug, Eq, PartialEq)] |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1864 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1865 | #[non_exhaustive] |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1866 | pub struct LinkPreview { |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1867 | /// the url as it appears in the message, or as it was asked about |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1868 | pub url: String, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1869 | /// where the page says it lives, when that's somewhere else |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1870 | pub canonical_url: Option<String>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1871 | pub title: Option<String>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1872 | pub description: Option<String>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1873 | pub site_name: Option<String>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1874 | pub image: Option<LinkPreviewImage>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1875 | } |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1876 | |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1877 | #[derive(Clone, Debug, Eq, PartialEq)] |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1878 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1879 | #[non_exhaustive] |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1880 | pub struct LinkPreviewImage { |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1881 | pub media_id: MediaId, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1882 | pub mimetype: Option<String>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1883 | pub size_bytes: Option<u64>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1884 | pub width: Option<u64>, |
0291516d40b5 | atagen | 2026-10-22 08:31 UTC | 1885 | pub height: Option<u64>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1886 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1887 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1888 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1889 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1890 | pub enum MessageKind { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1891 | Text, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1892 | Emote, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1893 | Notice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1894 | ServerNotice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1895 | Image, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1896 | Video, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1897 | Audio, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1898 | File, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1899 | Location, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1900 | VerificationRequest, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1901 | Other(String), |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1902 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1903 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1904 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1905 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1906 | pub enum MembershipChange { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1907 | Joined, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1908 | Left, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1909 | Banned, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1910 | Unbanned, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1911 | Kicked, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1912 | KickedAndBanned, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1913 | Invited, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1914 | InvitationAccepted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1915 | InvitationRejected, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1916 | InvitationRevoked, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1917 | Knocked, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1918 | KnockAccepted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1919 | KnockRetracted, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1920 | KnockDenied, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1921 | /// nothing a person would call a change, or something the sdk couldn't make sense of |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1922 | Other, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1923 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1924 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1925 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1926 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1927 | pub struct Change<T> { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1928 | pub old: T, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1929 | pub new: T, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1930 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1931 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1932 | /// 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 | 1933 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1934 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1935 | pub enum UtdCause { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1936 | Unknown, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1937 | SentBeforeWeJoined, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1938 | VerificationViolation, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1939 | UnsignedDevice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1940 | UnknownDevice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1941 | HistoricalMessageAndBackupIsDisabled, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1942 | WithheldForUnverifiedOrInsecureDevice, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1943 | WithheldBySender, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 1944 | HistoricalMessageAndDeviceIsUnverified, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1945 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1946 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1947 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1948 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1949 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1950 | pub struct ThreadSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1951 | pub reply_count: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1952 | pub latest_event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1953 | pub latest_event_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1954 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1955 | |
21b9227729a4 | atagen | 2026-10-25 11:03 UTC | 1956 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
21b9227729a4 | atagen | 2026-10-25 11:03 UTC | 1957 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
60454002af5f | atagen | 2026-10-25 11:13 UTC | 1958 | pub enum ThreadListCloseReason { |
21b9227729a4 | atagen | 2026-10-25 11:03 UTC | 1959 | /// `Close` asked for it |
21b9227729a4 | atagen | 2026-10-25 11:03 UTC | 1960 | Requested, |
60454002af5f | atagen | 2026-10-25 11:13 UTC | 1961 | /// left, kicked or banned |
60454002af5f | atagen | 2026-10-25 11:13 UTC | 1962 | RoomLeft, |
21b9227729a4 | atagen | 2026-10-25 11:03 UTC | 1963 | } |
21b9227729a4 | atagen | 2026-10-25 11:03 UTC | 1964 | |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1965 | #[derive(Clone, Debug, Eq, PartialEq)] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1966 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1967 | #[non_exhaustive] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1968 | pub struct ThreadListEntry { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1969 | pub root_event_id: OwnedEventId, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1970 | /// always an event, carrying `summary` as its own |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1971 | pub root: TimelineItem, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1972 | pub summary: ThreadSummary, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1973 | pub latest_reply: Option<TimelineItem>, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1974 | /// the latest reply's timestamp, or the root's before any reply |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1975 | pub latest_activity_ms: u64, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1976 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1977 | |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1978 | impl ThreadListEntry { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1979 | /// replaces the entry with the same root, or adds it, where its activity puts it. |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1980 | /// ties go by root event id |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1981 | pub fn upsert(entries: &mut Vector<Self>, entry: Self) { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1982 | if let Some(index) = entries |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1983 | .iter() |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1984 | .position(|known| known.root_event_id == entry.root_event_id) |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1985 | { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1986 | entries.remove(index); |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1987 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1988 | let index = entries |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1989 | .binary_search_by(|known| { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1990 | if known.sorts_before(&entry) { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1991 | std::cmp::Ordering::Less |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1992 | } else { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1993 | std::cmp::Ordering::Greater |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1994 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1995 | }) |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1996 | .unwrap_or_else(|index| index); |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1997 | entries.insert(index, entry); |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1998 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 1999 | |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2000 | #[must_use] |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2001 | pub fn sorts_before(&self, other: &Self) -> bool { |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2002 | ( |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2003 | std::cmp::Reverse(self.latest_activity_ms), |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2004 | &self.root_event_id, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2005 | ) < ( |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2006 | std::cmp::Reverse(other.latest_activity_ms), |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2007 | &other.root_event_id, |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2008 | ) |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2009 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2010 | } |
66db1b3cd895 | atagen | 2026-10-25 10:28 UTC | 2011 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2012 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2013 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2014 | pub enum SendState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2015 | Sent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2016 | Sending, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2017 | /// `will_retry` means macltok has it in hand. otherwise it's wedged until you |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2018 | /// `retry_send` or `cancel_send`, so that's when to show a retry button |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2019 | Failed { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2020 | will_retry: bool, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2021 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2022 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2023 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2024 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2025 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2026 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2027 | pub struct ReplyReference { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2028 | pub event_id: OwnedEventId, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2029 | pub details: ReplyDetails, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2030 | } |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2031 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2032 | /// 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 | 2033 | #[derive(Clone, Debug, Eq, PartialEq)] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2034 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2035 | pub enum ReplyDetails { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2036 | Pending, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2037 | Ready { |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2038 | sender: Sender, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2039 | content: Box<TimelineContent>, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2040 | timestamp_ms: u64, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2041 | }, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 2042 | Unavailable, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2043 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2044 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2045 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2046 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2047 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2048 | pub struct Reaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2049 | pub key: String, |
8fa8a7cde89c | atagen | 2026-10-08 12:39 UTC | 2050 | /// a custom emote's shortcode, from whichever sender gave one |
8fa8a7cde89c | atagen | 2026-10-08 12:39 UTC | 2051 | pub shortcode: Option<String>, |
8fa8a7cde89c | atagen | 2026-10-08 12:39 UTC | 2052 | /// the custom emote itself, when the key is an image |
8fa8a7cde89c | atagen | 2026-10-08 12:39 UTC | 2053 | pub image: Option<MediaId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2054 | pub count: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2055 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2056 | pub senders: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2057 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2058 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2059 | /// every custom emote and sticker pack the account can reach, from the user's own |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2060 | /// pack, each joined room's packs, and the rooms the user enabled everywhere |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2061 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2062 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2063 | #[non_exhaustive] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2064 | pub struct ImagePacks { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2065 | /// the user's own pack, then the packs of rooms enabled everywhere |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2066 | pub global: Vec<ImagePack>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2067 | /// each joined room's own packs, rooms without any left out |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2068 | pub rooms: imbl::HashMap<OwnedRoomId, Vec<ImagePack>>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2069 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2070 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2071 | impl ImagePacks { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2072 | /// 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 | 2073 | /// rest of the enabled ones, each pack once |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2074 | #[must_use] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2075 | pub fn for_room(&self, room_id: Option<&RoomId>) -> Vec<&ImagePack> { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2076 | let is_user = |pack: &&ImagePack| pack.source == ImagePackSource::User; |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2077 | let own = room_id.and_then(|room_id| self.rooms.get(room_id)); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2078 | let mut packs: Vec<&ImagePack> = self.global.iter().filter(is_user).collect(); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2079 | packs.extend(own.into_iter().flatten()); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2080 | for pack in self.global.iter().filter(|pack| !is_user(pack)) { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2081 | if !packs.iter().any(|seen| seen.id == pack.id) { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2082 | packs.push(pack); |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2083 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2084 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2085 | packs |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2086 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2087 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2088 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2089 | #[derive(Clone, Debug, Eq, PartialEq)] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2090 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2091 | #[non_exhaustive] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2092 | pub struct ImagePack { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2093 | /// `user`, or `room:<room id>:<state key>`, the same across calls |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2094 | pub id: String, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2095 | pub display_name: Option<String>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2096 | pub avatar: Option<MediaId>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2097 | pub attribution: Option<String>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2098 | pub source: ImagePackSource, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2099 | pub images: Vec<PackImage>, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 2100 | /// your own pack, or a room pack whose state you're allowed to send |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 2101 | pub editable: bool, |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 2102 | /// listed in im.ponies.emote_rooms. always true for your own pack |
fa51490b6ae9 | atagen | 2026-10-24 08:41 UTC | 2103 | pub enabled_everywhere: bool, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2104 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2105 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2106 | #[derive(Clone, Debug, Eq, PartialEq)] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2107 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2108 | pub enum ImagePackSource { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2109 | User, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2110 | Room { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2111 | room_id: OwnedRoomId, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2112 | state_key: String, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2113 | }, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2114 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2115 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2116 | #[derive(Clone, Debug, Eq, PartialEq)] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2117 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2118 | #[non_exhaustive] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2119 | pub struct PackImage { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2120 | pub shortcode: String, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2121 | pub media_id: MediaId, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2122 | /// what `toggle_reaction` takes to react with this image |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2123 | pub reaction_key: String, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2124 | pub body: Option<String>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2125 | pub mimetype: Option<String>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2126 | pub width: Option<u64>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2127 | pub height: Option<u64>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2128 | /// the image's own, else its pack's, else both |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2129 | pub usage: Vec<PackUsage>, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2130 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2131 | |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2132 | #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2133 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2134 | pub enum PackUsage { |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2135 | Emoticon, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2136 | Sticker, |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2137 | } |
17e042fbc331 | atagen | 2026-10-08 12:39 UTC | 2138 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2139 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2140 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2141 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2142 | pub struct MediaDescriptor { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2143 | pub id: MediaId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2144 | pub kind: MediaKind, |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 2145 | /// only for unencrypted media, an encrypted file's mxc is ciphertext without the keys |
9bd34e25bb86 | atagen | 2026-10-24 07:23 UTC | 2146 | pub mxc: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2147 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2148 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2149 | pub mimetype: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2150 | pub size_bytes: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2151 | pub width: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2152 | pub height: Option<u64>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2153 | pub duration_ms: Option<u64>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2154 | pub blurhash: Option<String>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2155 | /// the uploader sent a thumbnail, so `MediaSize::Thumbnail` won't need the server to resize |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2156 | pub has_thumbnail: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2157 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2158 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2159 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2160 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2161 | pub struct MediaId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2162 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2163 | impl MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2164 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2165 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2166 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2167 | |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2168 | /// plain media carries no keys, so it needs no registering and never expires |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2169 | pub(crate) fn plain<U: AsRef<str> + ?Sized>(uri: &U) -> Self { |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2170 | Self(uri.as_ref().to_owned()) |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2171 | } |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2172 | |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2173 | pub(crate) fn as_plain(&self) -> Option<&MxcUri> { |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2174 | self.0.starts_with("mxc://").then(|| self.0.as_str().into()) |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2175 | } |
5d2974de5826 | atagen | 2026-10-08 11:29 UTC | 2176 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2177 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2178 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2179 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2180 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2181 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2182 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2183 | /// 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 | 2184 | impl std::str::FromStr for MediaId { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2185 | type Err = std::convert::Infallible; |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2186 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2187 | fn from_str(value: &str) -> Result<Self, Self::Err> { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2188 | Ok(Self(value.to_owned())) |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2189 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2190 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2191 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2192 | impl From<String> for MediaId { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2193 | fn from(value: String) -> Self { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2194 | Self(value) |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2195 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2196 | } |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2197 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2198 | impl std::fmt::Display for MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2199 | fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2200 | self.0.fmt(formatter) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2201 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2202 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2203 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2204 | #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2205 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2206 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2207 | pub enum MediaSize { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2208 | Full, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2209 | /// a hint. an uploader's own thumbnail wins over the server resizing anything |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2210 | Thumbnail { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2211 | width: u32, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2212 | height: u32, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2213 | }, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2214 | } |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2215 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2216 | #[derive(Clone, Debug, Eq, PartialEq)] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2217 | #[non_exhaustive] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2218 | pub struct Media { |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2219 | pub bytes: Arc<[u8]>, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2220 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2221 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2222 | |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2223 | /// where media lives, for a host that fetches and decrypts it itself |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2224 | #[derive(Clone, Debug, Eq, PartialEq)] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2225 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2226 | pub enum MediaLocation { |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2227 | File(MediaFile), |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2228 | /// a resize of plaintext, so never encrypted. plenty of servers refuse some, and `media` |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2229 | /// then fetches `fallback` instead, so should you |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2230 | ServerThumbnail { |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2231 | url: String, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2232 | fallback: MediaFile, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2233 | }, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2234 | /// still in the send queue with no url yet. `media` has the bytes |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2235 | Local, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2236 | } |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2237 | |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2238 | #[derive(Clone, Debug, Eq, PartialEq)] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2239 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2240 | #[non_exhaustive] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2241 | pub struct MediaFile { |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2242 | pub url: String, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2243 | pub mimetype: Option<String>, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2244 | pub declared_size: Option<u64>, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2245 | pub encryption: Option<AttachmentEncryption>, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2246 | } |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2247 | |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2248 | /// AES-256-CTR, the only attachment cipher matrix has |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2249 | #[derive(Clone, Debug, Eq, PartialEq)] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2250 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2251 | #[non_exhaustive] |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2252 | pub struct AttachmentEncryption { |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2253 | /// the JWK `k`, unpadded url-safe base64 |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2254 | pub key: String, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2255 | /// unpadded base64, the initial counter block |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2256 | pub iv: String, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2257 | /// unpadded base64 SHA-256 of the whole ciphertext, so a partial read goes unchecked |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2258 | pub sha256: String, |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2259 | } |
5b21b919d1e6 | atagen | 2026-09-27 11:47 UTC | 2260 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2261 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2262 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2263 | pub enum MediaKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2264 | Image, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2265 | Video, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2266 | Audio, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2267 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2268 | Sticker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2269 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2270 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2271 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2272 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 2273 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2274 | pub struct TypingState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2275 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2276 | pub users: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2277 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2278 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2279 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2280 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2281 | pub enum HistoryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2282 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2283 | Loading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2284 | StartReached, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2285 | Failed(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2286 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2287 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2288 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2289 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2290 | pub enum RecentHistoryState { |
d9b96952ec60 | atagen | 2026-10-25 09:07 UTC | 2291 | /// nothing running and nothing to show, which is also what closing the room leaves |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2292 | Idle, |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2293 | Loading, |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2294 | Loaded, |
d9b96952ec60 | atagen | 2026-10-25 09:07 UTC | 2295 | Cancelled, |
002c79e4c6ec | atagen | 2026-10-25 10:42 UTC | 2296 | /// stays until a retry, or until closing the room makes it `Idle` |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2297 | Failed(String), |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2298 | } |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2299 | |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2300 | #[derive(Clone, Debug, Eq, PartialEq)] |
c9f0fd0ee1cc | atagen | 2026-10-25 06:16 UTC | 2301 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2302 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2303 | pub struct EncryptionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2304 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2305 | pub device_verified: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2306 | pub recovery: RecoveryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2307 | pub key_backup: KeyBackupState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2308 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2309 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2310 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2311 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2312 | pub enum KeyBackupState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2313 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2314 | Creating, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2315 | Enabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2316 | Resuming, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2317 | Downloading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2318 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2319 | Disabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2320 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2321 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2322 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2323 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2324 | pub enum RecoveryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2325 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2326 | Disabled, |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2327 | /// `enable_recovery` is running |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2328 | Enabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2329 | Incomplete, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2330 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2331 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2332 | |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2333 | /// shown to a person once. macltok never stores or logs it, and Debug hides it |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2334 | #[derive(Clone, Eq, PartialEq)] |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2335 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(transparent))] |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2336 | pub struct RecoveryKey(String); |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2337 | |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2338 | impl RecoveryKey { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2339 | pub(crate) fn new(key: String) -> Self { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2340 | Self(key) |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2341 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2342 | |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2343 | pub fn as_str(&self) -> &str { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2344 | &self.0 |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2345 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2346 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2347 | |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2348 | impl fmt::Debug for RecoveryKey { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2349 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2350 | formatter.write_str("RecoveryKey(...)") |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2351 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2352 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2353 | |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2354 | impl fmt::Display for RecoveryKey { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2355 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2356 | formatter.write_str(&self.0) |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2357 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2358 | } |
743123167e29 | atagen | 2026-10-26 04:02 UTC | 2359 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2360 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2361 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2362 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2363 | pub enum VerificationAction { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2364 | /// take up a request another device sent, which arrives as `VerificationState::Incoming` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2365 | Accept, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2366 | Confirm, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2367 | Reject, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2368 | Cancel, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2369 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2370 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2371 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2372 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2373 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2374 | pub enum VerificationTarget { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2375 | OwnIdentity, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2376 | User(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2377 | Device { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2378 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2379 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2380 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2381 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2382 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2383 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2384 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2385 | pub enum VerificationState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2386 | Waiting, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2387 | /// someone else asked. `Accept` to go ahead, `Cancel` to turn them down |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2388 | Incoming { |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2389 | user_id: OwnedUserId, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2390 | device_id: Option<OwnedDeviceId>, |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 2391 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2392 | Comparison { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2393 | emojis: Vec<(String, String)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2394 | decimals: (u16, u16, u16), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2395 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2396 | Confirmed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2397 | Done, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2398 | Cancelled(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2399 | Failed(VerificationFailure), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2400 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2401 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2402 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2403 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2404 | pub enum VerificationFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2405 | RequestAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2406 | SasStartup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2407 | SasAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2408 | RequestStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2409 | SasStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2410 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2411 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2412 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2413 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2414 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2415 | pub struct EngineFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2416 | pub kind: EngineErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2417 | pub message: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2418 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2419 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2420 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2421 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2422 | pub enum EngineErrorKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2423 | EventReceiverClosed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2424 | Watcher, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2425 | Other, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2426 | } |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2427 | |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2428 | #[derive(Clone, Debug, Eq, PartialEq)] |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2429 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2430 | pub struct PusherKey { |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2431 | pub app_id: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2432 | pub pushkey: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2433 | } |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2434 | |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2435 | #[derive(Clone, Debug, PartialEq)] |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2436 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2437 | pub struct HttpPusher { |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2438 | pub app_id: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2439 | pub pushkey: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2440 | pub app_display_name: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2441 | pub device_display_name: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2442 | pub lang: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2443 | pub url: String, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2444 | pub format: PushFormat, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2445 | /// sent beside `url` and `format` in the pusher's data, and back to the gateway in every push |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2446 | pub data: serde_json::Map<String, serde_json::Value>, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2447 | } |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2448 | |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2449 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2450 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2451 | pub enum PushFormat { |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2452 | Full, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2453 | EventIdOnly, |
2006a11ce142 | atagen | 2026-10-26 04:02 UTC | 2454 | } |