Skip to content

Commit dbad714

Browse files
r10sHocuri
andauthored
docs: clarify the meaning of is_verified() vs verifier_id() (#7027)
this PR adapts the documentation UI guidance to recent "green checkmark" discussions cmp deltachat/deltachat-pages#1145, deltachat/deltachat-ios#2781, deltachat/deltachat-android#3828, deltachat/deltachat-desktop#5318 --------- Co-authored-by: Hocuri <[email protected]>
1 parent edd8008 commit dbad714

File tree

4 files changed

+53
-45
lines changed

4 files changed

+53
-45
lines changed

deltachat-ffi/deltachat.h

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,12 +3818,6 @@ int dc_chat_can_send (const dc_chat_t* chat);
38183818
* Protected chats are created using dc_create_group_chat()
38193819
* by setting the 'protect' parameter to 1.
38203820
*
3821-
* UI should display a green checkmark
3822-
* in the chat title,
3823-
* in the chatlist item
3824-
* and in the chat profile
3825-
* if chat protection is enabled.
3826-
*
38273821
* @memberof dc_chat_t
38283822
* @param chat The chat object.
38293823
* @return 1=chat protected, 0=chat is not protected.
@@ -5259,20 +5253,14 @@ int dc_contact_is_blocked (const dc_contact_t* contact);
52595253

52605254
/**
52615255
* Check if the contact
5262-
* can be added to verified chats,
5263-
* i.e. has a verified key
5264-
* and Autocrypt key matches the verified key.
5256+
* can be added to protected chats.
52655257
*
5266-
* If contact is verified
5267-
* UI should display green checkmark after the contact name
5268-
* in contact list items,
5269-
* in chat member list items
5270-
* and in profiles if no chat with the contact exist (otherwise, use dc_chat_is_protected()).
5258+
* See dc_contact_get_verifier_id() for a guidance how to display these information.
52715259
*
52725260
* @memberof dc_contact_t
52735261
* @param contact The contact object.
52745262
* @return 0: contact is not verified.
5275-
* 2: SELF and contact have verified their fingerprints in both directions; in the UI typically checkmarks are shown.
5263+
* 2: SELF and contact have verified their fingerprints in both directions.
52765264
*/
52775265
int dc_contact_is_verified (dc_contact_t* contact);
52785266

@@ -5303,16 +5291,22 @@ int dc_contact_is_key_contact (dc_contact_t* contact);
53035291
/**
53045292
* Return the contact ID that verified a contact.
53055293
*
5306-
* If the function returns non-zero result,
5307-
* display green checkmark in the profile and "Introduced by ..." line
5308-
* with the name and address of the contact
5309-
* formatted by dc_contact_get_name_n_addr.
5294+
* As verifier may be unknown,
5295+
* use dc_contact_is_verified() to check if a contact can be added to a protected chat.
5296+
*
5297+
* UI should display the information in the contact's profile as follows:
5298+
*
5299+
* - If dc_contact_get_verifier_id() != 0,
5300+
* display text "Introduced by ..."
5301+
* with the name and address of the contact
5302+
* formatted by dc_contact_get_name_n_addr().
5303+
* Prefix the text by a green checkmark.
5304+
*
5305+
* - If dc_contact_get_verifier_id() == 0 and dc_contact_is_verified() != 0,
5306+
* display "Introduced" prefixed by a green checkmark.
53105307
*
5311-
* If this function returns a verifier,
5312-
* this does not necessarily mean
5313-
* you can add the contact to verified chats.
5314-
* Use dc_contact_is_verified() to check
5315-
* if a contact can be added to a verified chat instead.
5308+
* - if dc_contact_get_verifier_id() == 0 and dc_contact_is_verified() == 0,
5309+
* display nothing
53165310
*
53175311
* @memberof dc_contact_t
53185312
* @param contact The contact object.
@@ -6378,7 +6372,6 @@ void dc_event_unref(dc_event_t* event);
63786372

63796373
/**
63806374
* Chat changed. The name or the image of a chat group was changed or members were added or removed.
6381-
* Or the verify state of a chat has changed.
63826375
* See dc_set_chat_name(), dc_set_chat_profile_image(), dc_add_contact_to_chat()
63836376
* and dc_remove_contact_from_chat().
63846377
*

deltachat-jsonrpc/src/api/types/chat.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ pub struct FullChat {
2121

2222
/// True if the chat is protected.
2323
///
24-
/// UI should display a green checkmark
25-
/// in the chat title,
26-
/// in the chat profile title and
27-
/// in the chatlist item
28-
/// if chat protection is enabled.
29-
/// UI should also display a green checkmark
30-
/// in the contact profile
31-
/// if 1:1 chat with this contact exists and is protected.
24+
/// Only verified contacts
25+
/// as determined by [`ContactObject::is_verified`] / `Contact.isVerified`
26+
/// can be added to protected chats.
27+
///
28+
/// Protected chats are created using [`create_group_chat`] / `createGroupChat()`
29+
/// by setting the 'protect' parameter to true.
30+
///
31+
/// [`create_group_chat`]: crate::api::CommandApi::create_group_chat
3232
is_protected: bool,
33+
3334
/// True if the chat is encrypted.
3435
/// This means that all messages in the chat are encrypted,
3536
/// and all contacts in the chat are "key-contacts",

deltachat-jsonrpc/src/api/types/contact.rs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ pub struct ContactObject {
3131
/// e.g. if we just scanned the fingerprint from a QR code.
3232
e2ee_avail: bool,
3333

34-
/// True if the contact can be added to verified groups.
34+
/// True if the contact
35+
/// can be added to protected chats
36+
/// because SELF and contact have verified their fingerprints in both directions.
3537
///
36-
/// If this is true
37-
/// UI should display green checkmark after the contact name
38-
/// in contact list items,
39-
/// in chat member list items
40-
/// and in profiles if no chat with the contact exist.
38+
/// See [`Self::verifier_id`]/`Contact.verifierId` for a guidance how to display these information.
4139
is_verified: bool,
4240

4341
/// True if the contact profile title should have a green checkmark.
@@ -46,12 +44,29 @@ pub struct ContactObject {
4644
/// or will have a green checkmark if created.
4745
is_profile_verified: bool,
4846

49-
/// The ID of the contact that verified this contact.
47+
/// The contact ID that verified a contact.
5048
///
51-
/// If this is present,
52-
/// display a green checkmark and "Introduced by ..."
53-
/// string followed by the verifier contact name and address
54-
/// in the contact profile.
49+
/// As verifier may be unknown,
50+
/// use [`Self::is_verified`]/`Contact.isVerified` to check if a contact can be added to a protected chat.
51+
///
52+
/// UI should display the information in the contact's profile as follows:
53+
///
54+
/// - If `verifierId` != 0,
55+
/// display text "Introduced by ..."
56+
/// with the name and address of the contact
57+
/// formatted by `name_and_addr`/`nameAndAddr`.
58+
/// Prefix the text by a green checkmark.
59+
///
60+
/// - If `verifierId` == 0 and `isVerified` != 0,
61+
/// display "Introduced" prefixed by a green checkmark.
62+
///
63+
/// - if `verifierId` == 0 and `isVerified` == 0,
64+
/// display nothing
65+
///
66+
/// This contains the contact ID of the verifier.
67+
/// If it is `DC_CONTACT_ID_SELF`, we verified the contact ourself.
68+
/// If it is None/Null, we don't have verifier information or
69+
/// the contact is not verified.
5570
verifier_id: Option<u32>,
5671

5772
/// the contact's last seen timestamp

deltachat-jsonrpc/src/api/types/events.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ pub enum EventType {
224224
},
225225

226226
/// Chat changed. The name or the image of a chat group was changed or members were added or removed.
227-
/// Or the verify state of a chat has changed.
228227
/// See setChatName(), setChatProfileImage(), addContactToChat()
229228
/// and removeContactFromChat().
230229
///

0 commit comments

Comments
 (0)