Skip to content

Commit faf4fd1

Browse files
authored
api(CFFI): Add dc_contact_is_key_contact() (#6955)
We need this because it's not clear whether Android should switch to JsonRPC for everything, because of concerns that JsonRPC might be a lot slower than the CFFI (although we still need to measure that).
1 parent 53ebf2c commit faf4fd1

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

deltachat-ffi/deltachat.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5285,6 +5285,20 @@ int dc_contact_is_verified (dc_contact_t* contact);
52855285
int dc_contact_is_bot (dc_contact_t* contact);
52865286

52875287

5288+
/**
5289+
* Returns whether contact is a key-contact,
5290+
* i.e. it is identified by the public key
5291+
* rather than the email address.
5292+
*
5293+
* If so, all messages to and from this contact are encrypted.
5294+
*
5295+
* @memberof dc_contact_t
5296+
* @param contact The contact object.
5297+
* @return 1 if the contact is a key-contact, 0 if it is an address-contact.
5298+
*/
5299+
int dc_contact_is_key_contact (dc_contact_t* contact);
5300+
5301+
52885302
/**
52895303
* Return the contact ID that verified a contact.
52905304
*

deltachat-ffi/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4303,6 +4303,15 @@ pub unsafe extern "C" fn dc_contact_is_bot(contact: *mut dc_contact_t) -> libc::
43034303
(*contact).contact.is_bot() as libc::c_int
43044304
}
43054305

4306+
#[no_mangle]
4307+
pub unsafe extern "C" fn dc_contact_is_key_contact(contact: *mut dc_contact_t) -> libc::c_int {
4308+
if contact.is_null() {
4309+
eprintln!("ignoring careless call to dc_contact_is_key_contact()");
4310+
return 0;
4311+
}
4312+
(*contact).contact.is_key_contact() as libc::c_int
4313+
}
4314+
43064315
#[no_mangle]
43074316
pub unsafe extern "C" fn dc_contact_get_verifier_id(contact: *mut dc_contact_t) -> u32 {
43084317
if contact.is_null() {

0 commit comments

Comments
 (0)