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