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

mrcontact_tmrcontact_new ()
 Create a new contact object in memory.
 
void mrcontact_unref (mrcontact_t *ths)
 Free a contact object.
 
void mrcontact_empty (mrcontact_t *ths)
 Empty a contact object.
 
char * mrcontact_get_first_name (const char *full_name)
 Get the first name. More...
 
void mrcontact_normalize_name (char *full_name)
 Normalize a name in-place. More...
 

Public Attributes

uint32_t m_id
 The contact ID. More...
 
char * m_name
 may be NULL or empty, this name should not be spreaded as it may be "Daddy" and so on; initially set to m_authname
 
char * m_authname
 may be NULL or empty, this is the name authorized by the sender, only this name may be speaded to others, eg. More...
 
char * m_addr
 may be NULL or empty
 
int m_blocked
 Blocked state. 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

char * mrcontact_get_first_name ( const char *  full_name)

Get the first name.

In a string, get the part before the first space. If there is no space in the string, the whole string is returned.

Parameters
full_nameFull name of the contct.
Returns
String with the first name, must be free()'d after usage.
void mrcontact_normalize_name ( char *  full_name)

Normalize a name in-place.

  • Remove quotes (come from some bad MUA implementations)
  • Convert names as "Petersen, Björn" to "Björn Petersen"
  • Trims the resulting string
Parameters
full_nameBuffer with the name, is modified during processing; the resulting string may be shorter but never longer.
Returns
None. But the given buffer may be modified.

Member Data Documentation

char* mrcontact_t::m_authname

may be NULL or empty, this is the name authorized by the sender, only this name may be speaded to others, eg.

in To:-lists; for displaying in the app, use m_name

int mrcontact_t::m_blocked

Blocked state.

1=contact is blocked, 0=contact is not blocked.

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: