![]() |
Delta Chat Core C Interface
|
An object representing a single contact in memory. More...
#include <deltachat.h>
Public Member Functions | |
| char * | dc_contact_get_addr (const dc_contact_t *contact) |
| Get the e-mail address of a contact. | |
| char * | dc_contact_get_auth_name (const dc_contact_t *contact) |
| Get original contact name. | |
| uint32_t | dc_contact_get_color (const dc_contact_t *contact) |
| Get a color for the contact. | |
| char * | dc_contact_get_display_name (const dc_contact_t *contact) |
| Get display name. | |
| int | dc_contact_get_freshness (const dc_contact_t *contact) |
| Get the contact's freshness. | |
| uint32_t | dc_contact_get_id (const dc_contact_t *contact) |
| Get the ID of a contact. | |
| int64_t | dc_contact_get_last_seen (const dc_contact_t *contact) |
| Get the contact's last seen timestamp. | |
| char * | dc_contact_get_name (const dc_contact_t *contact) |
| Get the edited contact name. | |
| char * | dc_contact_get_profile_image (const dc_contact_t *contact) |
| Get the contact's profile image. | |
| char * | dc_contact_get_status (const dc_contact_t *contact) |
| Get the contact's status. | |
| int | dc_contact_is_blocked (const dc_contact_t *contact) |
| Check if a contact is blocked. | |
| int | dc_contact_is_bot (dc_contact_t *contact) |
| Returns whether contact is a bot. | |
| int | dc_contact_is_key_contact (dc_contact_t *contact) |
| Returns whether contact is a key-contact, i.e. | |
| void | dc_contact_unref (dc_contact_t *contact) |
| Free a contact object. | |
An object representing a single contact in memory.
The contact object is not updated. If you want an update, you have to recreate the object.
The library makes sure only to use names authorized by the contact in To: or Cc:. _Given-names _as "Daddy" or "Honey" are not used there. For this purpose, internally, two names are tracked - authorized-name and given-name. By default, these names are equal, but functions working with contact names (e.g. dc_contact_get_name(), dc_contact_get_display_name(), dc_create_contact() or dc_add_address_book()) only affect the given-name.
| char * dc_contact_get_addr | ( | const dc_contact_t * | contact | ) |
Get the e-mail address of a contact.
The e-mail address is always set for a contact.
| contact | The contact object. |
| char * dc_contact_get_auth_name | ( | const dc_contact_t * | contact | ) |
Get original contact name.
This is the name of the contact as defined by the contact themself. If the contact themself does not define such a name, an empty string is returned.
This function is typically only needed for the controls that allow the local user to edit the name, e.g. you want to show the original name somewhere in the edit dialog (you cannot use dc_contact_get_display_name() for that as this would return previously set edited names).
In most other situations than the name-edit-dialog, as lists, messages etc. use dc_contact_get_display_name().
| uint32_t dc_contact_get_color | ( | const dc_contact_t * | contact | ) |
Get a color for the contact.
The color is calculated from the contact's e-mail address and can be used for an fallback avatar with white initials as well as for headlines in bubbles of group chats.
| contact | The contact object. |
| char * dc_contact_get_display_name | ( | const dc_contact_t * | contact | ) |
Get display name.
This is the name as defined by the contact himself, modified by the user or, if both are unset, the e-mail address.
This name is typically used in lists. To get the name editable in a formular, use dc_contact_get_name().
In a group, you should show the sender's name over a message. To get it, call dc_msg_get_override_sender_name() first and if it returns NULL, call dc_contact_get_display_name().
| contact | The contact object. |
| int dc_contact_get_freshness | ( | const dc_contact_t * | contact | ) |
Get the contact's freshness.
The UI shall hightlight contacts that are recently seen by a little green dot on the avatar and contacts that were not seen for a long time by a string below the contact name (e.g. "Seen 2 months ago")
To get the time a contact was seen, use dc_contact_get_last_seen().
| contact | The contact object. |
| uint32_t dc_contact_get_id | ( | const dc_contact_t * | contact | ) |
Get the ID of a contact.
| contact | The contact object. |
| int64_t dc_contact_get_last_seen | ( | const dc_contact_t * | contact | ) |
Get the contact's last seen timestamp.
| contact | The contact object. |
| char * dc_contact_get_name | ( | const dc_contact_t * | contact | ) |
Get the edited contact name.
This is the name as given or modified by the local user using dc_create_contact(). If there is no such name for the contact, an empty string is returned. The function does not return the contact name as received from the network.
This name is typically used in a form where the user can edit the name of a contact. To get a fine name to display in lists etc., use dc_contact_get_display_name().
| contact | The contact object. |
| char * dc_contact_get_profile_image | ( | const dc_contact_t * | contact | ) |
Get the contact's profile image.
This is the image set by each remote user on their own using dc_set_config(context, "selfavatar", image).
| contact | The contact object. |
| char * dc_contact_get_status | ( | const dc_contact_t * | contact | ) |
Get the contact's status.
Status is the last signature received in a message from this contact.
| contact | The contact object. |
| int dc_contact_is_blocked | ( | const dc_contact_t * | contact | ) |
Check if a contact is blocked.
To block or unblock a contact, use dc_block_contact().
| contact | The contact object. |
| int dc_contact_is_bot | ( | dc_contact_t * | contact | ) |
Returns whether contact is a bot.
| contact | The contact object. |
| int dc_contact_is_key_contact | ( | 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.
| contact | The contact object. |
| void dc_contact_unref | ( | dc_contact_t * | contact | ) |
Free a contact object.
| contact | The contact object as created e.g. by dc_get_contact(). If NULL is given, nothing is done. |