Delta Chat Core C-API
Public Member Functions | Public Attributes | List of all members
mrcontact_t Struct Reference

An object representing a single contact in memory. More...

#include <mrcontact.h>

Public Member Functions

void mrcontact_unref (mrcontact_t *contact)
 Free a contact object. More...
 
char * mrcontact_get_addr (mrcontact_t *contact)
 Get email address. More...
 
char * mrcontact_get_name (mrcontact_t *contact)
 Get name. More...
 
char * mrcontact_get_display_name (mrcontact_t *contact)
 Get display name. More...
 
char * mrcontact_get_name_n_addr (mrcontact_t *contact)
 Get a summary of name and address. More...
 
int mrcontact_is_blocked (mrcontact_t *contact)
 Check if a contact is blocked. More...
 

Public Attributes

uint32_t m_id
 The contact ID. More...
 

Detailed Description

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.

Member Function Documentation

void mrcontact_unref ( mrcontact_t contact)

Free a contact object.

Parameters
contactThe contact object as created eg. by mrmailbox_get_contact().
Returns
None.
char * mrcontact_get_addr ( mrcontact_t contact)

Get email address.

The email address is always set for a contact.

Parameters
contactThe contact object.
Returns
String with the email address, must be free()'d. Never returns NULL.
char * mrcontact_get_name ( mrcontact_t contact)

Get name.

This is the name as defined the the contact himself or modified by the user. May be an empty string.

This name is typically used in a form where the user can edit the name of a contact. This name must not be spreaded via mail (To:, CC: ...) as it as it may be sth. like "Daddy". To get a fine name to display in lists etc., use mrcontact_get_display_name() or mrcontact_get_name_n_addr().

Parameters
contactThe contact object.
Returns
String with the name to display, must be free()'d. Empty string if unset, never returns NULL.
char * mrcontact_get_display_name ( mrcontact_t contact)

Get display name.

This is the name as defined the the contact himself, modified by the user or, if both are unset, the email address.

This name is typically used in lists and must not be speaded via mail (To:, CC: ...). To get the name editable in a formular, use mrcontact_get_edit_name().

Parameters
contactThe contact object.
Returns
String with the name to display, must be free()'d. Never returns NULL.
char * mrcontact_get_name_n_addr ( mrcontact_t contact)

Get a summary of name and address.

The returned string is either "Name (email@domain.com)" or just "email@domain.com" if the name is unset.

The summary is typically used when asking the user something about the contact. The attached email address makes the question unique, eg. "Chat with Alan Miller (am@uniquedomain.com)?"

The summary must not be spreaded via mail (To:, CC: ...) as it as it may contain sth. like "Daddy".

Parameters
contactThe contact object.
Returns
Summary string, must be free()'d. Never returns NULL.
int mrcontact_is_blocked ( mrcontact_t contact)

Check if a contact is blocked.

To block or unblock a contact, use mrmailbox_block_contact().

Parameters
contactThe contact object.
Returns
1=contact is blocked, 0=contact is not blocked.

Member Data Documentation

uint32_t mrcontact_t::m_id

The contact ID.

Special message IDs:

  • MR_CONTACT_ID_SELF (1) - this is the owner of the mailbox with the email-address set by mrmailbox_set_config() using "addr".

Normal contact IDs are larger than these special ones (larger than MR_CONTACT_ID_LAST_SPECIAL).


The documentation for this struct was generated from the following files: