diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 233f19242..1098e46b9 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -5285,6 +5285,20 @@ int dc_contact_is_verified (dc_contact_t* contact); int dc_contact_is_bot (dc_contact_t* contact); +/** + * Returns whether contact is a key-contact, + * i.e. it is identified by the public key + * rather than the email address. + * + * If so, all messages to and from this contact are encrypted. + * + * @memberof dc_contact_t + * @param contact The contact object. + * @return 1 if the contact is a key-contact, 0 if it is an address-contact. + */ +int dc_contact_is_key_contact (dc_contact_t* contact); + + /** * Return the contact ID that verified a contact. * diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 3567879cc..c8a7316bd 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -4303,6 +4303,15 @@ pub unsafe extern "C" fn dc_contact_is_bot(contact: *mut dc_contact_t) -> libc:: (*contact).contact.is_bot() as libc::c_int } +#[no_mangle] +pub unsafe extern "C" fn dc_contact_is_key_contact(contact: *mut dc_contact_t) -> libc::c_int { + if contact.is_null() { + eprintln!("ignoring careless call to dc_contact_is_key_contact()"); + return 0; + } + (*contact).contact.is_key_contact() as libc::c_int +} + #[no_mangle] pub unsafe extern "C" fn dc_contact_get_verifier_id(contact: *mut dc_contact_t) -> u32 { if contact.is_null() {