pub struct Chat {
pub rowid: i32,
pub chat_identifier: String,
pub service_name: Option<String>,
pub display_name: Option<String>,
pub is_filtered: Option<i32>,
pub is_blackholed: Option<bool>,
pub is_pending_review: Option<bool>,
}Expand description
Row from the chat table.
Fields§
§rowid: i32Chat row ID.
chat_identifier: StringPhone number, email, or group chat identifier.
service_name: Option<String>Service name stored for the chat.
display_name: Option<String>User-provided chat display name.
is_filtered: Option<i32>Raw conversation-list tier from chat.is_filtered, used to build
the ChatFilterStatus via Self::filter_status.
is_blackholed: Option<bool>Raw chat.is_blackholed flag: 1 denotes a chat whose incoming
messages are silently dropped.
is_pending_review: Option<bool>Raw chat.is_pending_review flag: 1 denotes a filtered chat awaiting
review.
Implementations§
Source§impl Chat
impl Chat
Sourcepub fn get(db: &Connection) -> Result<CachedStatement<'_>, TableError>
pub fn get(db: &Connection) -> Result<CachedStatement<'_>, TableError>
Prepare the SELECT * statement for the chat table.
Sourcepub fn by_rowid(db: &Connection) -> Result<HashMap<i32, Chat>, TableError>
pub fn by_rowid(db: &Connection) -> Result<HashMap<i32, Chat>, TableError>
Map chat rows by row ID.
One conversation may have several chat row IDs. Call
crate::tables::chat_handle::ChatToHandle::dedupe after caching the
participant sets and handle groups.
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::chat::Chat;
let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
let chatrooms = Chat::by_rowid(&conn);Source§impl Chat
impl Chat
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Return the non-empty custom display name.
Sourcepub fn filter_status(&self) -> Option<ChatFilterStatus>
pub fn filter_status(&self) -> Option<ChatFilterStatus>
Parse the conversation-list tier from Self::is_filtered.
A raw 0 maps to ChatFilterStatus::Unfiltered. None remains
None, and every unrecognized value maps to ChatFilterStatus::Unknown.
Sourcepub fn properties(&self, db: &Connection) -> Option<Properties>
pub fn properties(&self, db: &Connection) -> Option<Properties>
Parse Properties from the chat’s plist blob.
Calling this reads a BLOB from the database.
Trait Implementations§
Source§impl Table for Chat
impl Table for Chat
Source§fn from_row(row: &Row<'_>) -> Result<Chat>
fn from_row(row: &Row<'_>) -> Result<Chat>
Self. Returns rusqlite::Result
for direct use inside rusqlite::query_map / query_row
callbacks. For high-level iteration, prefer Table::rows or
Table::row.Source§fn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>where
Self: 'stmt,
fn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>where
Self: 'stmt,
stmt, deserializing each row through
from_row. Return TableError for both fetch and
deserialization failures. Pass either a rusqlite::Statement or a
rusqlite::CachedStatement (via deref coercion).Source§fn row<P: Params>(
stmt: &mut Statement<'_>,
params: P,
) -> Result<Self, TableError>
fn row<P: Params>( stmt: &mut Statement<'_>, params: P, ) -> Result<Self, TableError>
stmt. Returns
TableError::QueryError if the row is missing or fails to
deserialize. Accepts both rusqlite::Statement and
rusqlite::CachedStatement (the latter via deref coercion).