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