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, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 20 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 21 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 22 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 23 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 24 | pub enum MentionCaptureState { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 25 | Pending, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 26 | Partial, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 27 | Ready, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 28 | Unavailable, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 29 | Failed { message: String, retry_at_ms: u64 }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 30 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 31 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 32 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 33 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 34 | pub struct MentionEntry { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 35 | pub key: MentionKey, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 36 | pub timestamp_ms: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 37 | pub discovered_at_ms: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 38 | pub discovery_revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 39 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 40 | pub event: TimelineItem, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 41 | pub reasons: Vec<MentionReason>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 42 | pub read: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 43 | pub capture: MentionCaptureState, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 44 | pub room_name: Option<String>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 45 | pub notification_suppressed: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 46 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 47 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 48 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 49 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 50 | pub struct MentionCoverage { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 51 | pub earliest_timestamp_ms: Option<u64>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 52 | pub historical_supported: Option<bool>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 53 | pub recovering: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 54 | pub incomplete_history: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 55 | pub gaps: Vec<MentionGap>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 56 | pub truncated: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 57 | pub unresolved_candidates: usize, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 58 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 59 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 60 | impl Default for MentionCoverage { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 61 | fn default() -> Self { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 62 | Self { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 63 | earliest_timestamp_ms: None, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 64 | historical_supported: None, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 65 | recovering: false, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 66 | incomplete_history: true, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 67 | gaps: Vec::new(), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 68 | truncated: false, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 69 | unresolved_candidates: 0, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 70 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 71 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 72 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 73 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 74 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 75 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 76 | pub struct MentionGap { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 77 | pub room_id: Option<OwnedRoomId>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 78 | pub reason: String, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 79 | pub token: Option<String>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 80 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 81 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 82 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 83 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 84 | pub struct MentionsBoundary { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 85 | pub account: OwnedUserId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 86 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 87 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 88 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 89 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 90 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 91 | pub struct MentionsPage { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 92 | pub entries: Vec<MentionEntry>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 93 | pub next_cursor: Option<String>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 94 | pub end_reached: bool, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 95 | pub coverage: MentionCoverage, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 96 | pub unread_count: usize, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 97 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 98 | pub boundary: MentionsBoundary, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 99 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 100 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 101 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 102 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 103 | pub struct SavedMentionContext { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 104 | pub key: MentionKey, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 105 | pub state: MentionCaptureState, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 106 | pub context: Option<EventContext>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 107 | pub revision: u64, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 108 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 109 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 110 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 111 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 112 | pub struct MentionsUpdate { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 113 | pub snapshot: MentionsPage, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 114 | pub upserts: Vec<MentionEntry>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 115 | pub removed: Vec<MentionKey>, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 116 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 117 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 118 | #[derive(Clone, Debug, Eq, PartialEq)] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 119 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 120 | pub enum MentionsCommand { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 121 | Page { cursor: Option<String>, limit: u16 }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 122 | Context(MentionKey), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 123 | RetryContext(MentionKey), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 124 | SetRead { keys: Vec<MentionKey>, read: bool }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 125 | ReadThrough(MentionsBoundary), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 126 | Recover, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 127 | } |