api: add dc_contact_is_profile_verified()

This commit is contained in:
link2xt
2023-11-07 02:47:59 +00:00
parent 003a27f625
commit 48416289ac
6 changed files with 85 additions and 13 deletions

View File

@@ -208,9 +208,10 @@ impl ChatId {
self == DC_CHAT_ID_ALLDONE_HINT
}
/// Returns the [`ChatId`] for the 1:1 chat with `contact_id` if it exists.
/// Returns the [`ChatId`] for the 1:1 chat with `contact_id`
/// if it exists and is not blocked.
///
/// If it does not exist, `None` is returned.
/// If the chat does not exist or is blocked, `None` is returned.
pub async fn lookup_by_contact(
context: &Context,
contact_id: ContactId,
@@ -1251,6 +1252,16 @@ impl ChatId {
Ok(())
}
/// Returns true if the chat is protected.
pub async fn is_protected(self, context: &Context) -> Result<ProtectionStatus> {
let protection_status = context
.sql
.query_get_value("SELECT protected FROM chats WHERE id=?", (self,))
.await?
.unwrap_or_default();
Ok(protection_status)
}
}
impl std::fmt::Display for ChatId {