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: 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: 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: i32

Implementations§

Get the body text of a message

Get a vector of string slices of the 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.

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

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

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

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

Gets the time until the message was read. This can happen in two ways:

  • You recieved 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 recieved column (date). In the latter case, this subtracts the date delivered column (date_delivered) from the date recieved 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.

true if the message is a response to a thread, else false

true if the message renames a thread, else false

true if the message is a reaction to another message, else false

true if the message is sticker, else false

true if the message has an expressive presentation, else false

true if the message has a URL preview, else false

true if the message was edited, else false

true if the message has attachments, else false

Get the index of the part of a message a reply is pointing to

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);

Build a HashMap of message component index to messages that react to that component

Build a HashMap of message component index to messages that reply to that component

Get the variant of a message, see crate::message_types::variants for detail.

Determine the service the message was sent from, i.e. iMessage, SMS, IRC, etc.

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

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

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

Determine which expressive the message was sent with

Trait Implementations§

Used for reactions that do not exist in a foreign key table

Formats the value using the given formatter. Read more

Emit diagnotsic 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);
Serializes a single row of data to an instance of the struct that implements this Trait
Gets a statment we can exectue to iterate over the data in the table
Extract valid row data while handling both types of query errors

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.