96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1 | use std::{fmt, sync::Arc}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 3 | use ruma::{ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 4 | OwnedDeviceId, OwnedEventId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 5 | OwnedServerName, OwnedTransactionId, OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 6 | events::{AnySyncTimelineEvent, room::member::StrippedRoomMemberEvent}, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 7 | serde::Raw, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 8 | }; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 9 | #[cfg(feature = "serde")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 10 | use serde::{Deserialize, Serialize}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 11 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 12 | #[derive(Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 13 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 14 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 15 | pub enum Command { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 16 | Account(AccountCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 17 | Room(RoomCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 18 | Timeline(TimelineCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 19 | Media(MediaCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 20 | Encryption(EncryptionCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 21 | Notification(NotificationCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 22 | Lifecycle(LifecycleCommand), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 23 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 24 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 25 | #[derive(Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 26 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 27 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 28 | pub enum AccountCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 29 | Logout, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 30 | RenameDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 31 | device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 32 | display_name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 33 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 34 | DeleteDevices { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 35 | device_ids: Vec<OwnedDeviceId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 36 | auth: Option<crate::InteractiveAuth>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 37 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 38 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 39 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 40 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 41 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 42 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 43 | pub enum RoomCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 44 | Open(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 45 | Close(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 46 | Join { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 47 | room: OwnedRoomOrAliasId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 48 | via: Vec<OwnedServerName>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 49 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 50 | Leave(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 51 | Forget(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 52 | AcceptInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 53 | RejectInvite(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 54 | InviteUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 55 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 56 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 57 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 58 | KickUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 59 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 60 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 61 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 62 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 63 | BanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 64 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 65 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 66 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 67 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 68 | UnbanUser { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 69 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 70 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 71 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 72 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 73 | SetPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 74 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 75 | changes: PowerLevelChanges, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 76 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 77 | SetUserPowerLevel { |
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 | level: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 81 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 82 | Create(CreateRoomOptions), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 83 | /// hands back the existing dm if there is one |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 84 | CreateDirect(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 85 | CancelSend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 86 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 87 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 88 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 89 | RetrySend { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 90 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 91 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 92 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 93 | SetTyping { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 94 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 95 | typing: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 96 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 97 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 98 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 99 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 100 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 101 | pub struct CreateRoomOptions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 102 | pub name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 103 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 104 | pub alias_localpart: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 105 | pub invite: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 106 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 107 | pub visibility: RoomVisibility, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 108 | pub preset: Option<RoomPreset>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 109 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 110 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 111 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 112 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 113 | pub enum RoomVisibility { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 114 | #[default] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 115 | Private, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 116 | Public, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 117 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 118 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 119 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 120 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 121 | pub enum RoomPreset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 122 | PrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 123 | TrustedPrivateChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 124 | PublicChat, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 125 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 126 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 127 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 128 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 129 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 130 | pub enum TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 131 | OpenThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 132 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 133 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 134 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 135 | CloseThread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 136 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 137 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 138 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 139 | /// Re-emit an authoritative reset for an open room or thread without |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 140 | /// closing it. The reset arrives before this command's terminal result. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 141 | Resync { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 142 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 143 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 144 | Paginate { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 145 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 146 | limit: u16, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 147 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 148 | Send { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 149 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 150 | content: MessageContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 151 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 152 | Edit { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 153 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 154 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 155 | content: MessageEditContent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 156 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 157 | Redact { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 158 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 159 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 160 | reason: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 161 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 162 | ToggleReaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 163 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 164 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 165 | key: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 166 | }, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 167 | /// works on a closed room too, it just can't refuse to move the marker backwards |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 168 | MarkRead { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 169 | timeline_id: TimelineId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 170 | event_id: OwnedEventId, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 171 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 172 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 173 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 174 | impl TimelineCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 175 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 176 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 177 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 178 | Self::OpenThread { room_id, .. } | Self::CloseThread { room_id, .. } => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 179 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 180 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 181 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 182 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 183 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 184 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 185 | | Self::MarkRead { timeline_id, .. } => timeline_id.room_id(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 186 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 187 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 188 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 189 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 190 | pub const fn timeline_id(&self) -> Option<&TimelineId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 191 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 192 | Self::OpenThread { .. } | Self::CloseThread { .. } => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 193 | Self::Resync { timeline_id } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 194 | | Self::Paginate { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 195 | | Self::Send { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 196 | | Self::Edit { timeline_id, .. } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 197 | | Self::Redact { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 198 | | Self::ToggleReaction { timeline_id, .. } |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 199 | | Self::MarkRead { timeline_id, .. } => Some(timeline_id), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 200 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 201 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 202 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 203 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 204 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 205 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 206 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 207 | pub enum TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 208 | Room(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 209 | Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 210 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 211 | root_event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 212 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 213 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 214 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 215 | impl TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 216 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 217 | pub const fn room_id(&self) -> &OwnedRoomId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 218 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 219 | Self::Room(room_id) | Self::Thread { room_id, .. } => room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 220 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 221 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 222 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 223 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 224 | pub fn thread(room_id: OwnedRoomId, root_event_id: OwnedEventId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 225 | Self::Thread { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 226 | room_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 227 | root_event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 228 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 229 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 230 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 231 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 232 | pub fn thread_root(&self) -> Option<&OwnedEventId> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 233 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 234 | Self::Room(_) => None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 235 | Self::Thread { root_event_id, .. } => Some(root_event_id), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 236 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 237 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 238 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 239 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 240 | impl From<OwnedRoomId> for TimelineId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 241 | fn from(room_id: OwnedRoomId) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 242 | Self::Room(room_id) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 243 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 244 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 245 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 246 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 247 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 248 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 249 | pub enum MediaCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 250 | Fetch { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 251 | id: MediaId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 252 | size: MediaSize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 253 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 254 | Upload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 255 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 256 | filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 257 | mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 258 | bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 259 | caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 260 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 261 | UploadAttachment(AttachmentUpload), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 262 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 263 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 264 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 265 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 266 | pub struct AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 267 | pub timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 268 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 269 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 270 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 271 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 272 | pub details: Option<UploadDetails>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 273 | pub thumbnail: Option<UploadThumbnail>, |
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 | impl AttachmentUpload { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 277 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 278 | pub fn new( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 279 | timeline_id: impl Into<TimelineId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 280 | filename: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 281 | mimetype: impl Into<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 282 | bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 283 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 284 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 285 | timeline_id: timeline_id.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 286 | filename: filename.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 287 | mimetype: mimetype.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 288 | bytes, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 289 | caption: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 290 | details: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 291 | thumbnail: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 292 | } |
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 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 297 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 298 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 299 | pub enum UploadDetails { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 300 | Image { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 301 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 302 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 303 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 304 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 305 | Video { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 306 | width: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 307 | height: Option<u32>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 308 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 309 | blurhash: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 310 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 311 | Audio { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 312 | duration_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 313 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 314 | Voice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 315 | duration_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 316 | waveform: Vec<u16>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 317 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 318 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 319 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 320 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 321 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 322 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 323 | pub struct UploadThumbnail { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 324 | pub bytes: Vec<u8>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 325 | pub mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 326 | pub width: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 327 | pub height: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 328 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 329 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 330 | #[derive(Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 331 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 332 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 333 | pub enum EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 334 | Recover(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 335 | CreateKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 336 | EnableKeyBackup, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 337 | DisableKeyBackup { delete_from_server: bool }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 338 | RecoverKeyBackup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 339 | StartVerification(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 340 | Verify(VerificationAction), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 341 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 342 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 343 | impl fmt::Debug for EncryptionCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 344 | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 345 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 346 | Self::Recover(_) => formatter.debug_tuple("Recover").field(&"...").finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 347 | Self::CreateKeyBackup => formatter.write_str("CreateKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 348 | Self::EnableKeyBackup => formatter.write_str("EnableKeyBackup"), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 349 | Self::DisableKeyBackup { delete_from_server } => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 350 | .debug_struct("DisableKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 351 | .field("delete_from_server", delete_from_server) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 352 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 353 | Self::RecoverKeyBackup(_) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 354 | .debug_tuple("RecoverKeyBackup") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 355 | .field(&"...") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 356 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 357 | Self::StartVerification(target) => formatter |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 358 | .debug_tuple("StartVerification") |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 359 | .field(target) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 360 | .finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 361 | Self::Verify(action) => formatter.debug_tuple("Verify").field(action).finish(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 362 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 363 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 364 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 365 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 366 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 367 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 368 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 369 | pub enum NotificationCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 370 | SetRoomMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 371 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 372 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 373 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 374 | ResetRoomMode(OwnedRoomId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 375 | SetDefaultMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 376 | encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 377 | one_to_one: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 378 | mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 379 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 380 | AddKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 381 | RemoveKeyword(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 382 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 383 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 384 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 385 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 386 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 387 | pub enum LifecycleCommand { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 388 | Shutdown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 389 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 390 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 391 | impl Command { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 392 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 393 | pub const fn kind(&self) -> CommandKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 394 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 395 | Self::Account(_) => CommandKind::Account, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 396 | Self::Room(_) => CommandKind::Room, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 397 | Self::Timeline(_) => CommandKind::Timeline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 398 | Self::Media(_) => CommandKind::Media, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 399 | Self::Encryption(_) => CommandKind::Encryption, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 400 | Self::Notification(_) => CommandKind::Notification, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 401 | Self::Lifecycle(_) => CommandKind::Lifecycle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 402 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 403 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 404 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 405 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 406 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 407 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 408 | pub enum CommandKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 409 | Account, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 410 | Room, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 411 | Timeline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 412 | Media, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 413 | Encryption, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 414 | Notification, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 415 | Lifecycle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 416 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 417 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 418 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 419 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 420 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 421 | pub enum MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 422 | Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 423 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 424 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 425 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 426 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 427 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 428 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 429 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 430 | Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 431 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 432 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 433 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 434 | notify_replied_to: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 435 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 436 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 437 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 438 | impl MessageContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 439 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 440 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 441 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 442 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 443 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 444 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 445 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 446 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 447 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 448 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 449 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 450 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 451 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 452 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 453 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 454 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 455 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 456 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 457 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 458 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 459 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 460 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 461 | pub fn reply(event_id: OwnedEventId, content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 462 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 463 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 464 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 465 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 466 | notify_replied_to: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 467 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 468 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 469 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 470 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 471 | pub fn reply_without_notification( |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 472 | event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 473 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 474 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 475 | ) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 476 | Self::Reply { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 477 | event_id, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 478 | content, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 479 | mentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 480 | notify_replied_to: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 481 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 482 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 483 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 484 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 485 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 486 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 487 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 488 | pub enum MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 489 | Text { |
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 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 493 | Emote { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 494 | content: RichText, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 495 | mentions: MessageMentions, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 496 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 497 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 498 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 499 | impl MessageEditContent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 500 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 501 | pub fn text(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 502 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 503 | content: RichText::plain(body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 504 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 505 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 506 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 507 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 508 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 509 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 510 | Self::Text { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 511 | content: RichText::html(body, formatted_body), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 512 | mentions: MessageMentions::default(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 513 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 514 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 515 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 516 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 517 | pub fn emote(content: RichText, mentions: MessageMentions) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 518 | Self::Emote { content, mentions } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 519 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 520 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 521 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 522 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 523 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 524 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 525 | pub struct RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 526 | pub body: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 527 | pub formatted_body: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 528 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 529 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 530 | impl RichText { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 531 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 532 | pub fn plain(body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 533 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 534 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 535 | formatted_body: None, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 536 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 537 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 538 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 539 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 540 | pub fn html(body: impl Into<String>, formatted_body: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 541 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 542 | body: body.into(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 543 | formatted_body: Some(formatted_body.into()), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 544 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 545 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 546 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 547 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 548 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 549 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 550 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 551 | pub struct MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 552 | pub user_ids: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 553 | pub room: bool, |
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 | impl MessageMentions { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 557 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 558 | pub fn with_user_ids(user_ids: impl IntoIterator<Item = OwnedUserId>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 559 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 560 | user_ids: user_ids.into_iter().collect(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 561 | room: false, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 562 | } |
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 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 566 | pub fn room() -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 567 | Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 568 | user_ids: Vec::new(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 569 | room: true, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 570 | } |
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 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 575 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 576 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 577 | pub enum Event { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 578 | ConnectionChanged(ConnectionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 579 | Authenticated { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 580 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 581 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 582 | /// Refresh tokens changed. Persist a fresh `ClientHandle::session_record()` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 583 | /// atomically; a record captured before this event may no longer restore. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 584 | SessionTokensChanged, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 585 | /// the server stopped honouring our token and the engine stops. on a soft |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 586 | /// logout keep the store and log in again with the same device, otherwise |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 587 | /// the record and the store are both dead |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 588 | SessionAccessRejected { |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 589 | soft_logout: bool, |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 590 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 591 | NotificationSettingsChanged, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 592 | VerificationTargetChanged(VerificationTarget), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 593 | InteractiveAuthRequired { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 594 | id: CommandId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 595 | command: CommandKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 596 | challenge: crate::InteractiveAuthChallenge, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 597 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 598 | RoomsChanged, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 599 | /// Authoritative snapshot on open or resync. A resync reset precedes the |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 600 | /// corresponding terminal command event on this stream. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 601 | TimelineReset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 602 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 603 | items: Vec<TimelineItem>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 604 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 605 | TimelineChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 606 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 607 | diffs: Vec<TimelineDiff>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 608 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 609 | HistoryChanged { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 610 | timeline_id: TimelineId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 611 | state: HistoryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 612 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 613 | TypingChanged(TypingState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 614 | MediaReady { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 615 | media_id: MediaId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 616 | size: MediaSize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 617 | bytes: Arc<[u8]>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 618 | mimetype: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 619 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 620 | MediaUploadProgress { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 621 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 622 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 623 | uploaded_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 624 | total_bytes: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 625 | complete: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 626 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 627 | MediaUploadFailed { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 628 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 629 | transaction_id: OwnedTransactionId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 630 | kind: CommandErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 631 | recoverable: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 632 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 633 | EncryptionChanged(EncryptionState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 634 | VerificationChanged(VerificationState), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 635 | /// Terminal command success. For sends, this means the SDK send queue |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 636 | /// accepted the item; network delivery is reflected by its send state. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 637 | CommandSucceeded { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 638 | id: CommandId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 639 | command: CommandKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 640 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 641 | CommandSucceededWithRoom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 642 | id: CommandId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 643 | command: CommandKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 644 | room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 645 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 646 | /// Terminal failure correlated by `CommandFailure::id`. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 647 | CommandFailed(CommandFailure), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 648 | /// logout went through and the engine stops. delete the record and the store |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 649 | LoggedOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 650 | Failed(EngineFailure), |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 651 | /// always the last event. keep the saved record unless `LoggedOut` or a |
fa9114fcf75f | atagen | 2026-09-24 12:51 UTC | 652 | /// hard `SessionAccessRejected` came first. commands still in flight get no result |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 653 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 654 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 655 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 656 | #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 657 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 658 | pub struct CommandId(u64); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 659 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 660 | impl CommandId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 661 | pub(crate) const fn new(value: u64) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 662 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 663 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 664 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 665 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 666 | pub const fn get(self) -> u64 { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 667 | self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 668 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 669 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 670 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 671 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 672 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 673 | pub enum ConnectionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 674 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 675 | Connecting, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 676 | Online, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 677 | Offline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 678 | Stopped, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 679 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 680 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 681 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 682 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 683 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 684 | pub struct RoomSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 685 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 686 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 687 | pub membership: RoomMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 688 | pub unread_messages: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 689 | pub unread_mentions: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 690 | pub encrypted: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 691 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 692 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 693 | pub favourite: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 694 | pub low_priority: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 695 | pub avatar: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 696 | pub latest_event_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 697 | pub notification_mode: Option<RoomNotificationMode>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 698 | pub notification_mode_custom: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 699 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 700 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 701 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 702 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 703 | pub enum RoomNotificationMode { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 704 | AllMessages, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 705 | MentionsAndKeywordsOnly, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 706 | Mute, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 707 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 708 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 709 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 710 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 711 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 712 | pub struct RoomNotificationSettings { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 713 | pub mode: RoomNotificationMode, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 714 | pub custom: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 715 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 716 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 717 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 718 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 719 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 720 | pub enum PushNotificationStatus { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 721 | Event(Box<PushNotification>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 722 | NotFound, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 723 | FilteredOut, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 724 | Redacted, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 725 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 726 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 727 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 728 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 729 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 730 | pub struct PushNotification { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 731 | pub event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 732 | pub event: PushNotificationEvent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 733 | pub sender: PushNotificationSender, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 734 | pub room: PushNotificationRoom, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 735 | pub noisy: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 736 | pub has_mention: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 737 | pub thread_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 738 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 739 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 740 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 741 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 742 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 743 | pub struct PushNotificationSender { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 744 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 745 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 746 | pub avatar_url: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 747 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 748 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 749 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 750 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 751 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 752 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 753 | pub struct PushNotificationRoom { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 754 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 755 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 756 | pub avatar_url: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 757 | pub canonical_alias: Option<OwnedRoomAliasId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 758 | pub topic: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 759 | pub encrypted: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 760 | pub direct: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 761 | pub joined_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 762 | pub service_members: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 763 | pub active_service_members_count: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 764 | pub space: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 765 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 766 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 767 | #[derive(Clone, Debug)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 768 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 769 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 770 | pub enum PushNotificationEvent { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 771 | Timeline(Raw<AnySyncTimelineEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 772 | Invite(Raw<StrippedRoomMemberEvent>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 773 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 774 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 775 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 776 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 777 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 778 | pub struct RoomPowerLevels { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 779 | pub ban: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 780 | pub invite: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 781 | pub kick: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 782 | pub redact: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 783 | pub events_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 784 | pub state_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 785 | pub users_default: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 786 | pub room_notification: i64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 787 | pub users: Vec<(OwnedUserId, i64)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 788 | pub events: Vec<(String, i64)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 789 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 790 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 791 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 792 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 793 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 794 | pub struct PowerLevelChanges { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 795 | pub ban: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 796 | pub invite: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 797 | pub kick: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 798 | pub redact: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 799 | pub events_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 800 | pub state_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 801 | pub users_default: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 802 | pub room_notification: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 803 | pub room_name: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 804 | pub room_avatar: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 805 | pub room_topic: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 806 | pub space_child: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 807 | pub beacon: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 808 | pub beacon_info: Option<i64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 809 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 810 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 811 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 812 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 813 | pub enum RoomMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 814 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 815 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 816 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 817 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 818 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 819 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 820 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 821 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 822 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 823 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 824 | pub struct RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 825 | pub membership: Option<RoomMembership>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 826 | pub category: Option<RoomCategory>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 827 | pub favourite: Option<bool>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 828 | pub unread_only: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 829 | pub search: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 830 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 831 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 832 | impl RoomListFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 833 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 834 | pub fn with_membership(mut self, membership: RoomMembership) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 835 | self.membership = Some(membership); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 836 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 837 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 838 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 839 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 840 | pub fn with_category(mut self, category: RoomCategory) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 841 | self.category = Some(category); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 842 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 843 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 844 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 845 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 846 | pub fn with_favourite(mut self, favourite: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 847 | self.favourite = Some(favourite); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 848 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 849 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 850 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 851 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 852 | pub const fn with_unread_only(mut self, unread_only: bool) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 853 | self.unread_only = unread_only; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 854 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 855 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 856 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 857 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 858 | pub fn with_search(mut self, search: impl Into<String>) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 859 | self.search = Some(search.into()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 860 | self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 861 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 862 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 863 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 864 | pub fn matches(&self, room: &RoomSummary) -> bool { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 865 | self.membership |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 866 | .is_none_or(|membership| room.membership == membership) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 867 | && self.category.is_none_or(|category| match category { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 868 | RoomCategory::People => room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 869 | RoomCategory::Rooms => !room.direct && !room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 870 | RoomCategory::Spaces => room.space, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 871 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 872 | && self |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 873 | .favourite |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 874 | .is_none_or(|favourite| room.favourite == favourite) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 875 | && (!self.unread_only || room.unread_messages > 0 || room.unread_mentions > 0) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 876 | && self.search.as_ref().is_none_or(|search| { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 877 | let search = search.to_lowercase(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 878 | room.name.to_lowercase().contains(&search) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 879 | || room.room_id.as_str().to_lowercase().contains(&search) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 880 | }) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 881 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 882 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 883 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 884 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 885 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 886 | pub enum RoomCategory { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 887 | People, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 888 | Rooms, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 889 | Spaces, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 890 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 891 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 892 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 893 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 894 | pub enum MemberFilter { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 895 | Active, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 896 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 897 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 898 | All, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 899 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 900 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 901 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 902 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 903 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 904 | pub enum MemberMembership { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 905 | Joined, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 906 | Invited, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 907 | Left, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 908 | Knocked, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 909 | Banned, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 910 | Custom(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 911 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 912 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 913 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 914 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 915 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 916 | pub struct MemberSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 917 | pub user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 918 | pub name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 919 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 920 | pub avatar: Option<OwnedMxcUri>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 921 | pub membership: MemberMembership, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 922 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 923 | pub name_ambiguous: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 924 | pub ignored: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 925 | pub service: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 926 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 927 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 928 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 929 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 930 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 931 | pub struct OwnDevice { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 932 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 933 | pub display_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 934 | pub last_seen_ip: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 935 | pub last_seen_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 936 | pub current: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 937 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 938 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 939 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 940 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 941 | pub enum TimelineItem { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 942 | Message(Box<TimelineMessage>), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 943 | DayDivider { timestamp_ms: u64 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 944 | ReadMarker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 945 | TimelineStart, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 946 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 947 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 948 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 949 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 950 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 951 | pub enum TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 952 | Append { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 953 | Clear, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 954 | PushFront { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 955 | PushBack { value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 956 | PopFront, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 957 | PopBack, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 958 | Insert { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 959 | Set { index: usize, value: TimelineItem }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 960 | Remove { index: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 961 | Truncate { length: usize }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 962 | Reset { values: Vec<TimelineItem> }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 963 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 964 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 965 | #[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 966 | #[error("timeline diff is incompatible with the current {length}-item snapshot")] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 967 | pub struct TimelineDiffError { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 968 | pub length: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 969 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 970 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 971 | impl TimelineDiff { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 972 | /// Apply a diff only when its indices match the current snapshot. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 973 | /// On error the snapshot is unchanged; request `TimelineCommand::Resync` |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 974 | /// and ignore further diffs until the corresponding `TimelineReset`. |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 975 | pub fn try_apply(self, items: &mut Vec<TimelineItem>) -> Result<(), TimelineDiffError> { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 976 | let length = items.len(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 977 | match self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 978 | Self::Append { values } => items.extend(values), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 979 | Self::Clear => items.clear(), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 980 | Self::PushFront { value } => items.insert(0, value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 981 | Self::PushBack { value } => items.push(value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 982 | Self::PopFront if length == 0 => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 983 | Self::PopFront => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 984 | items.remove(0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 985 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 986 | Self::PopBack if length == 0 => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 987 | Self::PopBack => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 988 | items.pop(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 989 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 990 | Self::Insert { index, .. } if index > length => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 991 | return Err(TimelineDiffError { length }); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 992 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 993 | Self::Insert { index, value } => items.insert(index, value), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 994 | Self::Set { index, .. } if index >= length => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 995 | Self::Set { index, value } => items[index] = value, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 996 | Self::Remove { index } if index >= length => return Err(TimelineDiffError { length }), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 997 | Self::Remove { index } => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 998 | items.remove(index); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 999 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1000 | Self::Truncate { length: target } if target > length => { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1001 | return Err(TimelineDiffError { length }); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1002 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1003 | Self::Truncate { length } => items.truncate(length), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1004 | Self::Reset { values } => *items = values, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1005 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1006 | Ok(()) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1007 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1008 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1009 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1010 | #[cfg(test)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1011 | mod tests { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1012 | use super::{TimelineDiff, TimelineItem}; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1013 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1014 | fn item(timestamp_ms: u64) -> TimelineItem { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1015 | TimelineItem::DayDivider { timestamp_ms } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1016 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1017 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1018 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1019 | fn timeline_diff_try_apply_handles_every_variant() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1020 | let mut items = vec![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1021 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1022 | TimelineDiff::Append { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1023 | values: vec![item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1024 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1025 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1026 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1027 | assert_eq!(items, vec![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1028 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1029 | TimelineDiff::Clear.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1030 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1031 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1032 | TimelineDiff::PushFront { value: item(2) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1033 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1034 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1035 | TimelineDiff::PushBack { value: item(3) } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1036 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1037 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1038 | assert_eq!(items, vec![item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1039 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1040 | TimelineDiff::PopFront.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1041 | TimelineDiff::PopBack.try_apply(&mut items).unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1042 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1043 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1044 | TimelineDiff::Reset { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1045 | values: vec![item(1), item(3)], |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1046 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1047 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1048 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1049 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1050 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1051 | value: item(2), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1052 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1053 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1054 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1055 | assert_eq!(items, vec![item(1), item(2), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1056 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1057 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1058 | index: 1, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1059 | value: item(4), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1060 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1061 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1062 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1063 | assert_eq!(items, vec![item(1), item(4), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1064 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1065 | TimelineDiff::Remove { index: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1066 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1067 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1068 | assert_eq!(items, vec![item(1), item(3)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1069 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1070 | TimelineDiff::Truncate { length: 1 } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1071 | .try_apply(&mut items) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1072 | .unwrap(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1073 | assert_eq!(items, vec![item(1)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1074 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1075 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1076 | #[test] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1077 | fn invalid_timeline_diff_leaves_snapshot_unchanged() { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1078 | let invalid = [ |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1079 | TimelineDiff::Insert { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1080 | index: 3, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1081 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1082 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1083 | TimelineDiff::Set { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1084 | index: 2, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1085 | value: item(3), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1086 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1087 | TimelineDiff::Remove { index: 2 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1088 | TimelineDiff::Truncate { length: 3 }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1089 | ]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1090 | for diff in invalid { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1091 | let mut items = vec![item(1), item(2)]; |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1092 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 2); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1093 | assert_eq!(items, vec![item(1), item(2)]); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1094 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1095 | for diff in [TimelineDiff::PopFront, TimelineDiff::PopBack] { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1096 | let mut items = Vec::new(); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1097 | assert_eq!(diff.try_apply(&mut items).unwrap_err().length, 0); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1098 | assert!(items.is_empty()); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1099 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1100 | } |
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, Hash, 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 | pub struct TimelineItemId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1106 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1107 | impl TimelineItemId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1108 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1109 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1110 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1111 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1112 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1113 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1114 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1115 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1116 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1117 | |
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 TimelineMessage { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1122 | pub item_id: TimelineItemId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1123 | pub event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1124 | pub transaction_id: Option<OwnedTransactionId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1125 | pub sender_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1126 | pub sender_name: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1127 | pub body: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1128 | pub formatted_body: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1129 | pub mentions: Option<MessageMentions>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1130 | pub thread_root: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1131 | pub thread_summary: Option<ThreadSummary>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1132 | pub timestamp_ms: u64, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1133 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1134 | pub send_state: SendState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1135 | pub edited: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1136 | pub unable_to_decrypt: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1137 | pub media: Option<MediaDescriptor>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1138 | pub reply_to: Option<ReplyReference>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1139 | pub reactions: Vec<Reaction>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1140 | pub read_by: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1141 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1142 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1143 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1144 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1145 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1146 | pub struct ThreadSummary { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1147 | pub reply_count: u32, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1148 | pub latest_event_id: Option<OwnedEventId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1149 | pub latest_event_timestamp_ms: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1150 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1151 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1152 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1153 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1154 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1155 | pub enum SendState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1156 | Sent, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1157 | Queued, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1158 | Sending, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1159 | Failed { retriable: bool }, |
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 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1163 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1164 | pub struct ReplyReference { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1165 | pub event_id: OwnedEventId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1166 | pub sender_id: Option<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1167 | pub sender_name: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1168 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1169 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1170 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1171 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1172 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1173 | pub struct Reaction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1174 | pub key: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1175 | pub count: usize, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1176 | pub own: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1177 | pub senders: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1178 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1179 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1180 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1181 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1182 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1183 | pub struct MediaDescriptor { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1184 | pub id: MediaId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1185 | pub kind: MediaKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1186 | pub filename: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1187 | pub caption: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1188 | pub mimetype: Option<String>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1189 | pub size_bytes: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1190 | pub width: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1191 | pub height: Option<u64>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1192 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1193 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1194 | #[derive(Clone, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1195 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1196 | pub struct MediaId(String); |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1197 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1198 | impl MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1199 | pub(crate) fn new(value: String) -> Self { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1200 | Self(value) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1201 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1202 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1203 | #[must_use] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1204 | pub fn as_str(&self) -> &str { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1205 | &self.0 |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1206 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1207 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1208 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1209 | impl std::fmt::Display for MediaId { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1210 | fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1211 | self.0.fmt(formatter) |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1212 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1213 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1214 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1215 | #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1216 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1217 | pub enum MediaSize { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1218 | Thumbnail, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1219 | Full, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1220 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1221 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1222 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1223 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1224 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1225 | pub enum MediaKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1226 | Image, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1227 | Video, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1228 | Audio, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1229 | File, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1230 | Sticker, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1231 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1232 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1233 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1234 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1235 | pub struct TypingState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1236 | pub room_id: OwnedRoomId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1237 | pub users: Vec<OwnedUserId>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1238 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1239 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1240 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1241 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1242 | pub enum HistoryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1243 | Idle, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1244 | Loading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1245 | StartReached, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1246 | Failed(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1247 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1248 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1249 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1250 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1251 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1252 | pub struct EncryptionState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1253 | pub device_id: OwnedDeviceId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1254 | pub device_verified: bool, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1255 | pub recovery: RecoveryState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1256 | pub key_backup: KeyBackupState, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1257 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1258 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1259 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1260 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1261 | pub enum KeyBackupState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1262 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1263 | Creating, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1264 | Enabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1265 | Resuming, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1266 | Downloading, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1267 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1268 | Disabling, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1269 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1270 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1271 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1272 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1273 | pub enum RecoveryState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1274 | Unknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1275 | Disabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1276 | Incomplete, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1277 | Enabled, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1278 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1279 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1280 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1281 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1282 | pub enum VerificationAction { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1283 | Confirm, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1284 | Reject, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1285 | Cancel, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1286 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1287 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1288 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1289 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1290 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1291 | pub enum VerificationTarget { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1292 | OwnIdentity, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1293 | User(OwnedUserId), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1294 | Device { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1295 | user_id: OwnedUserId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1296 | device_id: OwnedDeviceId, |
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 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1300 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1301 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1302 | pub enum VerificationState { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1303 | Waiting, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1304 | Comparison { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1305 | emojis: Vec<(String, String)>, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1306 | decimals: (u16, u16, u16), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1307 | }, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1308 | Confirmed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1309 | Done, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1310 | Cancelled(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1311 | Failed(VerificationFailure), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1312 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1313 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1314 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1315 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1316 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1317 | pub enum VerificationFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1318 | RequestAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1319 | SasStartup(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1320 | SasAcceptance(String), |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1321 | RequestStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1322 | SasStreamEnded, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1323 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1324 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1325 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1326 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1327 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1328 | pub struct CommandFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1329 | pub id: CommandId, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1330 | pub command: CommandKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1331 | pub kind: CommandErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1332 | pub message: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1333 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1334 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1335 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1336 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1337 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1338 | pub enum CommandErrorKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1339 | Unauthenticated, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1340 | RoomUnknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1341 | RoomNotOpen, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1342 | TimelineNotOpen, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1343 | RoomBusy, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1344 | QueueFull, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1345 | InteractiveAuthRequired, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1346 | EmptyBody, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1347 | MediaUnknown, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1348 | MediaTooLarge, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1349 | MediaUnavailable, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1350 | VerificationInactive, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1351 | VerificationUnsupported, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1352 | NoCrossSigningIdentity, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1353 | RecoveryRejected, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1354 | EventReceiverClosed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1355 | Network, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1356 | Server, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1357 | Store, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1358 | Timeline, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1359 | Encryption, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1360 | Other, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1361 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1362 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1363 | #[derive(Clone, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1364 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1365 | pub struct EngineFailure { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1366 | pub kind: EngineErrorKind, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1367 | pub message: String, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1368 | } |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1369 | |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1370 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1371 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1372 | #[non_exhaustive] |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1373 | pub enum EngineErrorKind { |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1374 | EventReceiverClosed, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1375 | Watcher, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1376 | Other, |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1377 | } |