Delta Chat Core C-API
Public Member Functions | Public Attributes | 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 mrchatlist_t object as created eg. More...
 
void mrchatlist_empty (mrchatlist_t *chatlist)
 Empty 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...
 
mrpoortext_tmrchatlist_get_summary (mrchatlist_t *chatlist, size_t index, mrchat_t *chat)
 Get a summary for a chatlist index. More...
 

Public Attributes

mrmailbox_tm_mailbox
 The mailbox, the chatlist belongs to.
 

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_empty ( mrchatlist_t chatlist)

Empty a chatlist object.

Parameters
chatlistThe chatlist object to empty.
Returns
None.
uint32_t mrchatlist_get_chat_id ( mrchatlist_t chatlist,
size_t  index 
)

Get a single chat ID of a chatlist.

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.
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_msg_id ( mrchatlist_t chatlist,
size_t  index 
)

Get a single message ID of a chatlist.

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.
mrpoortext_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 mrpoortext_t object with the following fields:

  • 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, the element is NULL (eg. for "No messages")
  • m_text1_meaning: one of the MR_TEXT1_* constants
  • 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)
  • m_timestamp: the timestamp of the message. May be 0 if there is no message
  • m_state: the state of the message as one of the MR_STATE_* identifiers. 0 if there is no message.
Parameters
chatlistThe chatlist to query as returned eg. from mrmailbox_get_chatlist().
indexThe index to query in the chatlist.
chatGiving the correct chat object here, this this will speed up things a little. If the chat object is not available by you, it is faster to pass NULL here.
Returns
The result must be freed using mrpoortext_unref(). The function never returns NULL.
void mrchatlist_unref ( mrchatlist_t chatlist)

Free a mrchatlist_t object as created eg.

by mrmailbox_get_chatlist().

Parameters
chatlistThe chatlist object to free.
Returns
None.

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