imessage_database/tables/messages/models/bubble_component.rs
1/*!
2 Per-part components of a parsed message body.
3*/
4
5use crate::tables::messages::models::attributed_range::AttributedRange;
6
7/// Component emitted for one logical message part.
8///
9/// # Component Types
10///
11/// A single iMessage contains data that may be represented across multiple bubbles.
12/// Each bubble corresponds to one `__kIMMessagePartAttributeName` index in the
13/// underlying [`NSAttributedString`](crate::util::typedstream); the
14/// [`Run`](Self::Run) groups every attributed range that shares that part index.
15#[derive(Debug, PartialEq, Clone)]
16pub enum BubbleComponent {
17 /// One bubble's worth of attributed body content. Each contained
18 /// [`AttributedRange`] models a single `NSAttributedString` attribute run
19 /// (a byte range plus its attribute dictionary); adjacent ranges that
20 /// share a `__kIMMessagePartAttributeName` index share the bubble.
21 ///
22 /// A run may interleave text ranges ([`AttributedRange::attachment`] is
23 /// `None`) with inline-attachment ranges (e.g. stickers rendered inline
24 /// like emoji), preserving their original order.
25 Run(Vec<AttributedRange>),
26 /// An [app integration](crate::message_types::app)
27 App,
28 /// A component that was retracted, found by parsing the [`EditedMessage`](crate::message_types::edited::EditedMessage)
29 Retracted,
30}