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