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

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

#include <mrchat.h>

Public Member Functions

void mrchat_unref (mrchat_t *chat)
 Free a chat object. More...
 
void mrchat_empty (mrchat_t *chat)
 Empty a chat object. More...
 
char * mrchat_get_subtitle (mrchat_t *chat)
 Get a subtitle for a chat. More...
 

Public Attributes

uint32_t m_id
 Chat ID under which the chat is filed in the database. More...
 
int m_type
 Chat type. More...
 
char * m_name
 NULL if unset.
 
time_t m_draft_timestamp
 0 if there is no draft
 
char * m_draft_text
 NULL if unset.
 
mrmailbox_tm_mailbox
 != NULL
 
int m_archived
 1=chat archived, this state should always be shown the UI, eg. More...
 
mrparam_tm_param
 != NULL
 

Detailed Description

An object representing a single chat in memory.

Chat objects are created using eg. mrmailbox_get_chat() and are not updated on database changes; if you want an update, you have to recreate the object.

Member Function Documentation

void mrchat_empty ( mrchat_t chat)

Empty a chat object.

Parameters
chatThe chat object to empty.
Returns
None.
char * mrchat_get_subtitle ( mrchat_t chat)

Get a subtitle for a chat.

The sibtitle is eg. the email-address or the number of group members.

Parameters
chatThe chat object to calulate the subtitle for.
Returns
Subtitle as a string. Must be free()'d after usage.
void mrchat_unref ( mrchat_t chat)

Free a chat object.

Parameters
chatChat object are returned eg. by mrmailbox_get_chat() or mrchat_new().
Returns
None.

Member Data Documentation

int mrchat_t::m_archived

1=chat archived, this state should always be shown the UI, eg.

the search will also return archived chats

uint32_t mrchat_t::m_id

Chat ID under which the chat is filed in the database.

Special IDs:

  • MR_CHAT_ID_DEADDROP (1) - Messages send from unknown/unwanted users to us, chats_contacts is not set up. This group may be shown normally.
  • MR_CHAT_ID_STARRED (5) - Virtual chat containing all starred messages-
  • MR_CHAT_ID_ARCHIVED_LINK (6) - A link at the end of the chatlist, if present the UI should show the button "Archived chats"-

"Normal" chat IDs are larger than these special IDs (larger than MR_CHAT_ID_LAST_SPECIAL).

int mrchat_t::m_type

Chat type.

  • MR_CHAT_TYPE_NORMAL (100) - a normal chat is a chat with a single contact, chats_contacts contains one record for the user, MR_CONTACT_ID_SELF (see mrcontact_t::m_id) is not added.
  • MR_CHAT_TYPE_GROUP (120) - a group chat, chats_contacts conain all group members, incl. MR_CONTACT_ID_SELF

If the chat type is not set, it is MR_CHAT_TYPE_UNDEFINED (0).


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