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
 Name given by the user to the contact. More...
 
char * m_authname
 Name authorized by the contact himself. More...
 
char * m_addr
 The E-Mail-Address of the contact. More...
 
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_addr

The E-Mail-Address of the contact.

May be NULL or empty.

char* mrcontact_t::m_authname

Name authorized by the contact himself.

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. To block or unblock a contact, use mrmailbox_block_contact().

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).

char* mrcontact_t::m_name

Name given by the user to the contact.

Should be used for displaying everywhere and is editable by the user but must not be spreaded via mail (To:, CC: ...) as it as it may be sth. like "Daddy".

May be NULL or empty, initially set to m_authname


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