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