cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 1 | use ruma::{OwnedEventId, OwnedRoomId, OwnedUserId}; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 2 | #[cfg(feature = "serde")] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 3 | use serde::{Deserialize, Serialize}; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 4 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 5 | use crate::{EventContext, TimelineItem}; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 6 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 7 | #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 8 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 9 | pub struct MentionKey { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 10 | pub room_id: OwnedRoomId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 11 | pub event_id: OwnedEventId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 12 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 13 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 14 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 15 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 16 | pub enum MentionReason { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 17 | Direct, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 18 | Reply, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 19 | Room, |
96680d38cc31 | atagen | 2026-10-25 09:20 UTC | 20 | /// a highlighting push rule matched with no structured mention or reply, such as a |
96680d38cc31 | atagen | 2026-10-25 09:20 UTC | 21 | /// notification keyword |
96680d38cc31 | atagen | 2026-10-25 09:20 UTC | 22 | Keyword, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 23 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 24 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 25 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 26 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 27 | pub enum MentionCaptureState { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 28 | Pending, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 29 | Partial, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 30 | Ready, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 31 | Unavailable, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 32 | Failed { message: String, retry_at_ms: u64 }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 33 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 34 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 35 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 36 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 37 | pub struct MentionEntry { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 38 | pub key: MentionKey, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 39 | pub timestamp_ms: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 40 | pub discovered_at_ms: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 41 | pub discovery_revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 42 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 43 | pub event: TimelineItem, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 44 | pub reasons: Vec<MentionReason>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 45 | pub read: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 46 | pub capture: MentionCaptureState, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 47 | pub room_name: Option<String>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 48 | pub notification_suppressed: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 49 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 50 | |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 51 | #[derive(Clone, Debug, Default, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 52 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 53 | pub struct MentionCoverage { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 54 | pub earliest_timestamp_ms: Option<u64>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 55 | pub historical_supported: Option<bool>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 56 | pub recovering: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 57 | pub gaps: Vec<MentionGap>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 58 | pub truncated: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 59 | pub unresolved_candidates: usize, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 60 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 61 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 62 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 63 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 64 | pub struct MentionGap { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 65 | pub room_id: Option<OwnedRoomId>, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 66 | pub reason: MentionGapReason, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 67 | pub token: Option<String>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 68 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 69 | |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 70 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 71 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 72 | pub enum MentionGapReason { |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 73 | SyncDiscontinuity, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 74 | /// an already observed room came back limited, `token` is its `prev_batch` |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 75 | LimitedTimeline, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 76 | RoomLeft, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 77 | ContextUnavailable, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 78 | NotificationHistoryUnavailable, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 79 | /// a candidate stayed undecryptable or unresolved for a week and was dropped |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 80 | CandidateExpired, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 81 | StoreReset, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 82 | /// a write failed, the inbox carries on in memory and a restart loses the unwritten part |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 83 | StoreFailed, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 84 | HookTimedOut, |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 85 | } |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 86 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 87 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 88 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 89 | pub struct MentionsBoundary { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 90 | pub account: OwnedUserId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 91 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 92 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 93 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 94 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 95 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 96 | pub struct MentionsPage { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 97 | pub entries: Vec<MentionEntry>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 98 | pub next_cursor: Option<String>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 99 | pub end_reached: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 100 | pub coverage: MentionCoverage, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 101 | pub unread_count: usize, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 102 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 103 | pub boundary: MentionsBoundary, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 104 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 105 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 106 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 107 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 108 | pub struct SavedMentionContext { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 109 | pub key: MentionKey, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 110 | pub state: MentionCaptureState, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 111 | pub context: Option<EventContext>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 112 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 113 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 114 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 115 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 116 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 117 | pub struct MentionsUpdate { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 118 | pub snapshot: MentionsPage, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 119 | pub upserts: Vec<MentionEntry>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 120 | pub removed: Vec<MentionKey>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 121 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 122 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 123 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 124 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
7cdaa86b9489 | atagen | 2026-10-25 08:43 UTC | 125 | #[non_exhaustive] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 126 | pub enum MentionsCommand { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 127 | Page { cursor: Option<String>, limit: u16 }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 128 | Context(MentionKey), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 129 | RetryContext(MentionKey), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 130 | SetRead { keys: Vec<MentionKey>, read: bool }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 131 | ReadThrough(MentionsBoundary), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 132 | Recover, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 133 | } |