mirror of
https://github.com/chatmail/core.git
synced 2026-05-11 10:56:29 +03:00
api: add dc_contact_is_profile_verified()
This commit is contained in:
15
src/chat.rs
15
src/chat.rs
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user