Delta Chat Core C-API
|
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... | |
uint32_t | mrchat_get_id (mrchat_t *chat) |
Get chat ID. More... | |
int | mrchat_get_type (mrchat_t *chat) |
Get chat type. More... | |
char * | mrchat_get_name (mrchat_t *chat) |
Get name of a chat. More... | |
char * | mrchat_get_subtitle (mrchat_t *chat) |
Get a subtitle for a chat. More... | |
char * | mrchat_get_profile_image (mrchat_t *chat) |
Get the chat's profile image. More... | |
char * | mrchat_get_draft (mrchat_t *chat) |
Get draft for the chat, if any. More... | |
time_t | mrchat_get_draft_timestamp (mrchat_t *chat) |
Get timestamp of the draft. More... | |
int | mrchat_get_archived (mrchat_t *chat) |
Get archived state. More... | |
int | mrchat_is_unpromoted (mrchat_t *chat) |
Check if a chat is still unpromoted. More... | |
int | mrchat_is_self_talk (mrchat_t *chat) |
Check if a chat is a self talk. More... | |
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.
void mrchat_unref | ( | mrchat_t * | chat | ) |
Free a chat object.
chat | Chat object are returned eg. by mrmailbox_get_chat(). |
uint32_t mrchat_get_id | ( | mrchat_t * | chat | ) |
Get chat ID.
The chat ID is the ID under which the chat is filed in the database.
Special IDs:
"Normal" chat IDs are larger than these special IDs (larger than MR_CHAT_ID_LAST_SPECIAL).
chat | The chat object. |
int mrchat_get_type | ( | mrchat_t * | chat | ) |
Get chat type.
Currently, there are two chat types:
chat | The chat object. |
char * mrchat_get_name | ( | mrchat_t * | chat | ) |
Get name of a chat.
For one-to-one chats, this is the name of the contact. For group chats, this is the name given eg. to mrmailbox_create_group_chat() or received by a group-creation message.
To change the name, use mrmailbox_set_chat_name()
See also: mrchat_get_subtitle()
chat | The chat object. |
char * mrchat_get_subtitle | ( | mrchat_t * | chat | ) |
Get a subtitle for a chat.
The subtitle is eg. the email-address or the number of group members.
See also: mrchat_get_name()
chat | The chat object to calulate the subtitle for. |
char * mrchat_get_profile_image | ( | mrchat_t * | chat | ) |
Get the chat's profile image.
The profile image is set using mrmailbox_set_chat_profile_image() for groups. For normal chats, the profile image is set using mrmailbox_set_contact_profile_image() (not yet implemented).
chat | The chat object. |
char * mrchat_get_draft | ( | mrchat_t * | chat | ) |
Get draft for the chat, if any.
A draft is a message that the user started to compose but that is not sent yet. You can save a draft for a chat using mrmailbox_set_draft().
Drafts are considered when sorting messages and are also returned eg. by mrchatlist_get_summary().
chat | The chat object. |
time_t mrchat_get_draft_timestamp | ( | mrchat_t * | chat | ) |
Get timestamp of the draft.
The draft itself can be get using mrchat_get_draft().
chat | The chat object. |
int mrchat_get_archived | ( | mrchat_t * | chat | ) |
Get archived state.
To archive or unarchive chats, use mrmailbox_archive_chat(). If chats are archived, this should be shown in the UI by a little icon or text, eg. the search will also return archived chats.
chat | The chat object. |
int mrchat_is_unpromoted | ( | mrchat_t * | chat | ) |
Check if a chat is still unpromoted.
Chats are unpromoted until the first message is sent. With unpromoted chats, members can be sent, settings can be modified without the need of special status messages being sent.
After the creation with mrmailbox_create_group_chat() the chat is usuall unpromoted until the first call to mrmailbox_send_msg() or mrmailbox_send_text_msg().
chat | The chat object. |
int mrchat_is_self_talk | ( | mrchat_t * | chat | ) |
Check if a chat is a self talk.
Self talks are normal chats with the only contact MR_CONTACT_ID_SELF.
chat | The chat object. |