Struct imessage_database::tables::messages::Message
source · pub struct Message {Show 22 fields
pub rowid: i32,
pub guid: String,
pub text: Option<String>,
pub service: Option<String>,
pub handle_id: i32,
pub subject: Option<String>,
pub date: i64,
pub date_read: i64,
pub date_delivered: i64,
pub is_from_me: bool,
pub is_read: bool,
pub group_title: Option<String>,
pub associated_message_guid: Option<String>,
pub associated_message_type: Option<i32>,
pub balloon_bundle_id: Option<String>,
pub expressive_send_style_id: Option<String>,
pub thread_originator_guid: Option<String>,
pub thread_originator_part: Option<String>,
pub date_edited: i64,
pub chat_id: Option<i32>,
pub num_attachments: i32,
pub num_replies: i32,
}Expand description
Represents a single row in the message table.
Fields§
§rowid: i32§guid: String§text: Option<String>§service: Option<String>§handle_id: i32§subject: Option<String>§date: i64§date_read: i64§date_delivered: i64§is_from_me: bool§is_read: bool§group_title: Option<String>§associated_message_guid: Option<String>§associated_message_type: Option<i32>§balloon_bundle_id: Option<String>§expressive_send_style_id: Option<String>§thread_originator_guid: Option<String>§thread_originator_part: Option<String>§date_edited: i64§chat_id: Option<i32>§num_attachments: i32§num_replies: i32Implementations§
source§impl Message
impl Message
sourcepub fn gen_text<'a>(
&'a mut self,
db: &'a Connection
) -> Result<&'a str, MessageError>
pub fn gen_text<'a>(
&'a mut self,
db: &'a Connection
) -> Result<&'a str, MessageError>
Get the body text of a message
sourcepub fn body(&self) -> Vec<BubbleType<'_>>
pub fn body(&self) -> Vec<BubbleType<'_>>
Get a vector of a message’s components
If the message has attachments, there will be one U+FFFC character
for each attachment and one U+FFFD for app messages that we need
to format.
An iMessage that contains body text like:
\u{FFFC}Check out this photo!
Will have a body() of:
[BubbleType::Attachment, BubbleType::Text("Check out this photo!")]
pub fn get_local_time(
&self,
date_stamp: &i64,
offset: &i64
) -> Result<DateTime<Local>, MessageError>
sourcepub fn date(&self, offset: &i64) -> Result<DateTime<Local>, MessageError>
pub fn date(&self, offset: &i64) -> Result<DateTime<Local>, MessageError>
Calculates the date a message was written to the database.
This field is stored as a unix timestamp with an epoch of 1/1/2001 00:00:00 in the local time zone
sourcepub fn date_delivered(
&self,
offset: &i64
) -> Result<DateTime<Local>, MessageError>
pub fn date_delivered(
&self,
offset: &i64
) -> Result<DateTime<Local>, MessageError>
Calculates the date a message was marked as delivered.
This field is stored as a unix timestamp with an epoch of 1/1/2001 00:00:00 in the local time zone
sourcepub fn date_read(&self, offset: &i64) -> Result<DateTime<Local>, MessageError>
pub fn date_read(&self, offset: &i64) -> Result<DateTime<Local>, MessageError>
Calculates the date a message was marked as read.
This field is stored as a unix timestamp with an epoch of 1/1/2001 00:00:00 in the local time zone
sourcepub fn date_edited(&self, offset: &i64) -> Result<DateTime<Local>, MessageError>
pub fn date_edited(&self, offset: &i64) -> Result<DateTime<Local>, MessageError>
Calculates the date a message was most recently edited.
This field is stored as a unix timestamp with an epoch of 1/1/2001 00:00:00 in the local time zone
sourcepub fn time_until_read(&self, offset: &i64) -> Option<String>
pub fn time_until_read(&self, offset: &i64) -> Option<String>
Gets the time until the message was read. This can happen in two ways:
- You received a message, then waited to read it
- You sent a message, and the recipient waited to read it
In the former case, this subtracts the date read column (date_read) from the date received column (date).
In the latter case, this subtracts the date delivered column (date_delivered) from the date received column (date).
Not all messages get tagged with the read properties. If more than one message has been sent in a thread before getting read, only the most recent message will get the tag.
sourcepub fn is_announcement(&self) -> bool
pub fn is_announcement(&self) -> bool
true if the message renames a thread, else false
sourcepub fn is_reaction(&self) -> bool
pub fn is_reaction(&self) -> bool
true if the message is a reaction to another message, else false
sourcepub fn is_sticker(&self) -> bool
pub fn is_sticker(&self) -> bool
true if the message is sticker, else false
sourcepub fn is_expressive(&self) -> bool
pub fn is_expressive(&self) -> bool
true if the message has an expressive presentation, else false
sourcepub fn has_attachments(&self) -> bool
pub fn has_attachments(&self) -> bool
true if the message has attachments, else false
sourcepub fn get_reply_index(&self) -> usize
pub fn get_reply_index(&self) -> usize
Get the index of the part of a message a reply is pointing to
sourcepub fn get_count(db: &Connection) -> u64
pub fn get_count(db: &Connection) -> u64
Get the number of messages in the database
Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::{Diagnostic, get_connection};
use imessage_database::tables::messages::Message;
let db_path = default_db_path();
let conn = get_connection(&db_path);
Message::get_count(&conn);sourcepub fn get_reactions<'a>(
&self,
db: &Connection,
reactions: &'a HashMap<String, Vec<String>>
) -> Result<HashMap<usize, Vec<Self>>, TableError>
pub fn get_reactions<'a>(
&self,
db: &Connection,
reactions: &'a HashMap<String, Vec<String>>
) -> Result<HashMap<usize, Vec<Self>>, TableError>
Build a HashMap of message component index to messages that react to that component
sourcepub fn get_replies(
&self,
db: &Connection
) -> Result<HashMap<usize, Vec<Self>>, TableError>
pub fn get_replies(
&self,
db: &Connection
) -> Result<HashMap<usize, Vec<Self>>, TableError>
Build a HashMap of message component index to messages that reply to that component
sourcepub fn variant(&self) -> Variant<'_>
pub fn variant(&self) -> Variant<'_>
Get the variant of a message, see crate::message_types::variants for detail.
sourcepub fn service(&self) -> Service<'_>
pub fn service(&self) -> Service<'_>
Determine the service the message was sent from, i.e. iMessage, SMS, IRC, etc.
sourcepub fn payload_data(&self, db: &Connection) -> Option<Value>
pub fn payload_data(&self, db: &Connection) -> Option<Value>
Get a message’s plist from the payload_data BLOB column
Calling this hits the database, so it is expensive and should only get invoked when needed.
This column contains data used by iMessage app balloons.
sourcepub fn message_summary_info(&self, db: &Connection) -> Option<Value>
pub fn message_summary_info(&self, db: &Connection) -> Option<Value>
Get a message’s plist from the message_summary_info BLOB column
Calling this hits the database, so it is expensive and should only get invoked when needed.
This column contains data used by edited iMessages.
sourcepub fn attributed_body(&self, db: &Connection) -> Option<Vec<u8>>
pub fn attributed_body(&self, db: &Connection) -> Option<Vec<u8>>
Get a message’s plist from the attributedBody BLOB column
Calling this hits the database, so it is expensive and should only get invoked when needed.
This column contains the message’s body text with any other attributes.
sourcepub fn get_expressive(&self) -> Expressive<'_>
pub fn get_expressive(&self) -> Expressive<'_>
Determine which expressive the message was sent with
Trait Implementations§
source§impl Diagnostic for Message
impl Diagnostic for Message
source§fn run_diagnostic(db: &Connection)
fn run_diagnostic(db: &Connection)
Emit diagnostic data for the Messages table
Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::{Diagnostic, get_connection};
use imessage_database::tables::messages::Message;
let db_path = default_db_path();
let conn = get_connection(&db_path);
Message::run_diagnostic(&conn);