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

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

#include <mrchatlist.h>

Public Member Functions

void mrchatlist_unref (mrchatlist_t *chatlist)
 Free a chatlist object. More...
 
size_t mrchatlist_get_cnt (mrchatlist_t *chatlist)
 Find out the number of chats in a chatlist. More...
 
uint32_t mrchatlist_get_chat_id (mrchatlist_t *chatlist, size_t index)
 Get a single chat ID of a chatlist. More...
 
uint32_t mrchatlist_get_msg_id (mrchatlist_t *chatlist, size_t index)
 Get a single message ID of a chatlist. More...
 
mrlot_tmrchatlist_get_summary (mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
 Get a summary for a chatlist index. More...
 

Detailed Description

An object representing a single chatlist in memory.

Chatlist objects contain chat IDs and, if possible, message IDs belonging to them. Chatlist objects are created eg. using mrmailbox_get_chatlist(). The chatlist object is not updated. If you want an update, you have to recreate the object.

Member Function Documentation

void mrchatlist_unref ( mrchatlist_t chatlist)

Free a chatlist object.

Parameters
chatlistThe chatlist object to free, created eg. by mrmailbox_get_chatlist(), mrmailbox_search_msgs().
Returns
None.
size_t mrchatlist_get_cnt ( mrchatlist_t chatlist)

Find out the number of chats in a chatlist.

Parameters
chatlistThe chatlist object as created eg. by mrmailbox_get_chatlist().
Returns
Returns the number of items in a mrchatlist_t object. 0 on errors or if the list is empty.
uint32_t mrchatlist_get_chat_id ( mrchatlist_t chatlist,
size_t  index 
)

Get a single chat ID of a chatlist.

To get the message object from the message ID, use mrmailbox_get_chat().

Parameters
chatlistThe chatlist object as created eg. by mrmailbox_get_chatlist().
indexThe index to get the chat ID for.
Returns
Returns the chat_id of the item at the given index. Index must be between 0 and mrchatlist_get_cnt()-1.
uint32_t mrchatlist_get_msg_id ( mrchatlist_t chatlist,
size_t  index 
)

Get a single message ID of a chatlist.

To get the message object from the message ID, use mrmailbox_get_msg().

Parameters
chatlistThe chatlist object as created eg. by mrmailbox_get_chatlist().
indexThe index to get the chat ID for.
Returns
Returns the message_id of the item at the given index. Index must be between 0 and mrchatlist_get_cnt()-1. If there is no message at the given index (eg. the chat may be empty), 0 is returned.
mrlot_t * mrchatlist_get_summary ( mrchatlist_t chatlist,
size_t  index,
mrchat_t chat 
)

Get a summary for a chatlist index.

The summary is returned by a mrlot_t object with the following fields:

  • mrlot_t::m_text1: contains the username or the strings "Me", "Draft" and so on. The string may be colored by having a look at m_text1_meaning. If there is no such name or it should not be displayed, the element is NULL.
  • mrlot_t::m_text1_meaning: one of MR_TEXT1_USERNAME, MR_TEXT1_SELF or MR_TEXT1_DRAFT. Typically used to show mrlot_t::m_text1 with different colors. 0 if not applicable.
  • mrlot_t::m_text2: contains an excerpt of the message text or strings as "No messages". May be NULL of there is no such text (eg. for the archive link)
  • mrlot_t::m_timestamp: the timestamp of the message. 0 if not applicable.
  • mrlot_t::m_state: The state of the message as one of the MR_STATE_* constants (see mrmsg_get_state()). 0 if not applicable.
Parameters
chatlistThe chatlist to query as returned eg. from mrmailbox_get_chatlist().
indexThe index to query in the chatlist.
chatTo speed up things, pass an already available chat object here. If the chat object is not yet available, it is faster to pass NULL.
Returns
The summary as an mrlot_t object. Must be freed using mrlot_unref(). NULL is never returned.

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