Skip to content

Commit 701dafe

Browse files
committed
api!: return boolean value from dc_contact_is_verified()
1 parent 4e956bd commit 701dafe

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

deltachat-ffi/deltachat.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5236,8 +5236,7 @@ int dc_contact_is_blocked (const dc_contact_t* contact);
52365236
*
52375237
* @memberof dc_contact_t
52385238
* @param contact The contact object.
5239-
* @return 0: contact is not verified.
5240-
* 2: SELF and contact have verified their fingerprints in both directions.
5239+
* @return 1=contact is verified, 0=contact is not verified.
52415240
*/
52425241
int dc_contact_is_verified (dc_contact_t* contact);
52435242

deltachat-ffi/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4250,17 +4250,10 @@ pub unsafe extern "C" fn dc_contact_is_verified(contact: *mut dc_contact_t) -> l
42504250
let ffi_contact = &*contact;
42514251
let ctx = &*ffi_contact.context;
42524252

4253-
if block_on(ffi_contact.contact.is_verified(ctx))
4253+
block_on(ffi_contact.contact.is_verified(ctx))
42544254
.context("is_verified failed")
42554255
.log_err(ctx)
4256-
.unwrap_or_default()
4257-
{
4258-
// Return value is essentially a boolean,
4259-
// but we return 2 for true for backwards compatibility.
4260-
2
4261-
} else {
4262-
0
4263-
}
4256+
.unwrap_or_default() as libc::c_int
42644257
}
42654258

42664259
#[no_mangle]

python/src/deltachat/contact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def unblock(self):
7373

7474
def is_verified(self) -> bool:
7575
"""Return True if the contact is verified."""
76-
return lib.dc_contact_is_verified(self._dc_contact) == 2
76+
return bool(lib.dc_contact_is_verified(self._dc_contact))
7777

7878
def get_verifier(self, contact) -> Optional["Contact"]:
7979
"""Return the address of the contact that verified the contact."""

0 commit comments

Comments
 (0)