mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-06 03:50:08 +02:00
update doxygen and declarations to new prefix
This commit is contained in:
parent
3ff8070ba7
commit
120442952d
15 changed files with 670 additions and 695 deletions
241
src/mrmsg.c
241
src/mrmsg.c
|
@ -32,19 +32,19 @@
|
|||
|
||||
/**
|
||||
* Create new message object. Message objects are needed eg. for sending messages using
|
||||
* mrmailbox_send_msg(). Moreover, they are returned eg. from mrmailbox_get_msg(),
|
||||
* dc_send_msg(). Moreover, they are returned eg. from dc_get_msg(),
|
||||
* set up with the current state of a message. The message object is not updated;
|
||||
* to achieve this, you have to recreate it.
|
||||
*
|
||||
* @private @memberof mrmsg_t
|
||||
* @private @memberof dc_msg_t
|
||||
*
|
||||
* @return The created message object.
|
||||
*/
|
||||
mrmsg_t* mrmsg_new()
|
||||
dc_msg_t* dc_msg_new()
|
||||
{
|
||||
mrmsg_t* ths = NULL;
|
||||
dc_msg_t* ths = NULL;
|
||||
|
||||
if( (ths=calloc(1, sizeof(mrmsg_t)))==NULL ) {
|
||||
if( (ths=calloc(1, sizeof(dc_msg_t)))==NULL ) {
|
||||
exit(15); /* cannot allocate little memory, unrecoverable error */
|
||||
}
|
||||
|
||||
|
@ -58,15 +58,15 @@ mrmsg_t* mrmsg_new()
|
|||
|
||||
|
||||
/**
|
||||
* Free a message object. Message objects are created eg. by mrmailbox_get_msg().
|
||||
* Free a message object. Message objects are created eg. by dc_get_msg().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object to free.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void mrmsg_unref(mrmsg_t* msg)
|
||||
void dc_msg_unref(dc_msg_t* msg)
|
||||
{
|
||||
if( msg==NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return;
|
||||
|
@ -82,13 +82,13 @@ void mrmsg_unref(mrmsg_t* msg)
|
|||
/**
|
||||
* Empty a message object.
|
||||
*
|
||||
* @private @memberof mrmsg_t
|
||||
* @private @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object to empty.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void mrmsg_empty(mrmsg_t* msg)
|
||||
void dc_msg_empty(dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return;
|
||||
|
@ -119,13 +119,13 @@ void mrmsg_empty(mrmsg_t* msg)
|
|||
/**
|
||||
* Get the ID of the message.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return the ID of the message, 0 on errors.
|
||||
*/
|
||||
uint32_t mrmsg_get_id(const mrmsg_t* msg)
|
||||
uint32_t dc_msg_get_id(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -137,20 +137,20 @@ uint32_t mrmsg_get_id(const mrmsg_t* msg)
|
|||
/**
|
||||
* Get the ID of contact who wrote the message.
|
||||
*
|
||||
* If the ID is equal to MR_CONTACT_ID_SELF (1), the message is an outgoing
|
||||
* If the ID is equal to DC_CONTACT_ID_SELF (1), the message is an outgoing
|
||||
* message that is typically shown on the right side of the chat view.
|
||||
*
|
||||
* Otherwise, the message is an incoming message; to get details about the sender,
|
||||
* pass the returned ID to mrmailbox_get_contact().
|
||||
* pass the returned ID to dc_get_contact().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return the ID of the contact who wrote the message, MR_CONTACT_ID_SELF (1)
|
||||
* @return the ID of the contact who wrote the message, DC_CONTACT_ID_SELF (1)
|
||||
* if this is an outgoing message, 0 on errors.
|
||||
*/
|
||||
uint32_t mrmsg_get_from_id(const mrmsg_t* msg)
|
||||
uint32_t dc_msg_get_from_id(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -161,17 +161,17 @@ uint32_t mrmsg_get_from_id(const mrmsg_t* msg)
|
|||
|
||||
/**
|
||||
* Get the ID of chat the message belongs to.
|
||||
* To get details about the chat, pass the returned ID to mrmailbox_get_chat().
|
||||
* If a message is still in the deaddrop, the ID MR_CHAT_ID_DEADDROP is returned
|
||||
* To get details about the chat, pass the returned ID to dc_get_chat().
|
||||
* If a message is still in the deaddrop, the ID DC_CHAT_ID_DEADDROP is returned
|
||||
* although internally another ID is used.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return the ID of the chat the message belongs to, 0 on errors.
|
||||
*/
|
||||
uint32_t mrmsg_get_chat_id(const mrmsg_t* msg)
|
||||
uint32_t dc_msg_get_chat_id(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -183,15 +183,15 @@ uint32_t mrmsg_get_chat_id(const mrmsg_t* msg)
|
|||
/**
|
||||
* Get the type of the message.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return One of MR_MSG_TEXT (10), MR_MSG_IMAGE (20), MR_MSG_GIF (21),
|
||||
* MR_MSG_AUDIO (40), MR_MSG_VOICE (41), MR_MSG_VIDEO (50), MR_MSG_FILE (60)
|
||||
* or MR_MSG_UNDEFINED (0) if the type is undefined.
|
||||
* @return One of DC_MSG_TEXT (10), DC_MSG_IMAGE (20), DC_MSG_GIF (21),
|
||||
* DC_MSG_AUDIO (40), DC_MSG_VOICE (41), DC_MSG_VIDEO (50), DC_MSG_FILE (60)
|
||||
* or DC_MSG_UNDEFINED (0) if the type is undefined.
|
||||
*/
|
||||
int mrmsg_get_type(const mrmsg_t* msg)
|
||||
int dc_msg_get_type(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return MR_MSG_UNDEFINED;
|
||||
|
@ -204,32 +204,32 @@ int mrmsg_get_type(const mrmsg_t* msg)
|
|||
* Get the state of a message.
|
||||
*
|
||||
* Incoming message states:
|
||||
* - MR_STATE_IN_FRESH (10) - Incoming _fresh_ message. Fresh messages are not noticed nor seen and are typically shown in notifications. Use mrmailbox_get_fresh_msgs() to get all fresh messages.
|
||||
* - MR_STATE_IN_NOTICED (13) - Incoming _noticed_ message. Eg. chat opened but message not yet read - noticed messages are not counted as unread but did not marked as read nor resulted in MDNs. Use mrmailbox_marknoticed_chat() or mrmailbox_marknoticed_contact() to mark messages as being noticed.
|
||||
* - MR_STATE_IN_SEEN (16) - Incoming message, really _seen_ by the user. Marked as read on IMAP and MDN may be send. Use mrmailbox_markseen_msgs() to mark messages as being seen.
|
||||
* - DC_STATE_IN_FRESH (10) - Incoming _fresh_ message. Fresh messages are not noticed nor seen and are typically shown in notifications. Use dc_get_fresh_msgs() to get all fresh messages.
|
||||
* - DC_STATE_IN_NOTICED (13) - Incoming _noticed_ message. Eg. chat opened but message not yet read - noticed messages are not counted as unread but did not marked as read nor resulted in MDNs. Use dc_marknoticed_chat() or dc_marknoticed_contact() to mark messages as being noticed.
|
||||
* - DC_STATE_IN_SEEN (16) - Incoming message, really _seen_ by the user. Marked as read on IMAP and MDN may be send. Use dc_markseen_msgs() to mark messages as being seen.
|
||||
*
|
||||
* Outgoing message states:
|
||||
* - MR_STATE_OUT_PENDING (20) - The user has send the "send" button but the
|
||||
* - DC_STATE_OUT_PENDING (20) - The user has send the "send" button but the
|
||||
* message is not yet sent and is pending in some way. Maybe we're offline (no checkmark).
|
||||
* - MR_STATE_OUT_ERROR (24) - _Unrecoverable_ error (_recoverable_ errors result in pending messages)
|
||||
* - MR_STATE_OUT_DELIVERED (26) - Outgoing message successfully delivered to server (one checkmark). Note, that already delivered messages may get into the state MR_STATE_OUT_ERROR if we get such a hint from the server.
|
||||
* - DC_STATE_OUT_ERROR (24) - _Unrecoverable_ error (_recoverable_ errors result in pending messages)
|
||||
* - DC_STATE_OUT_DELIVERED (26) - Outgoing message successfully delivered to server (one checkmark). Note, that already delivered messages may get into the state DC_STATE_OUT_ERROR if we get such a hint from the server.
|
||||
* If a sent message changes to this state, you'll receive the event #MR_EVENT_MSG_DELIVERED.
|
||||
* - MR_STATE_OUT_MDN_RCVD (28) - Outgoing message read by the recipient (two checkmarks; this requires goodwill on the receiver's side)
|
||||
* - DC_STATE_OUT_MDN_RCVD (28) - Outgoing message read by the recipient (two checkmarks; this requires goodwill on the receiver's side)
|
||||
* If a sent message changes to this state, you'll receive the event #MR_EVENT_MSG_READ.
|
||||
*
|
||||
* If you just want to check if a message is sent or not, please use mrmsg_is_sent() which regards all states accordingly.
|
||||
* If you just want to check if a message is sent or not, please use dc_msg_is_sent() which regards all states accordingly.
|
||||
*
|
||||
* The state of just created message objects is MR_STATE_UNDEFINED (0).
|
||||
* The state of just created message objects is DC_STATE_UNDEFINED (0).
|
||||
* The state is always set by the core-library, users of the library cannot set the state directly, but it is changed implicitly eg.
|
||||
* when calling mrmailbox_marknoticed_chat() or mrmailbox_markseen_msgs().
|
||||
* when calling dc_marknoticed_chat() or dc_markseen_msgs().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return The state of the message.
|
||||
*/
|
||||
int mrmsg_get_state(const mrmsg_t* msg)
|
||||
int dc_msg_get_state(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return MR_STATE_UNDEFINED;
|
||||
|
@ -244,13 +244,13 @@ int mrmsg_get_state(const mrmsg_t* msg)
|
|||
* Cave: the message list is sorted by receiving time (otherwise new messages would non pop up at the expected place),
|
||||
* however, if a message is delayed for any reason, the correct sending time will be displayed.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return The time of the message.
|
||||
*/
|
||||
time_t mrmsg_get_timestamp(const mrmsg_t* msg)
|
||||
time_t dc_msg_get_timestamp(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -273,15 +273,15 @@ time_t mrmsg_get_timestamp(const mrmsg_t* msg)
|
|||
* result eg. from decoding errors (assume some bytes missing in a mime structure, forcing
|
||||
* an attachment to be plain text).
|
||||
*
|
||||
* To get information about the message and more/raw text, use mrmailbox_get_msg_info().
|
||||
* To get information about the message and more/raw text, use dc_get_msg_info().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return Message text. The result must be free()'d. Never returns NULL.
|
||||
*/
|
||||
char* mrmsg_get_text(const mrmsg_t* msg)
|
||||
char* dc_msg_get_text(const dc_msg_t* msg)
|
||||
{
|
||||
char* ret;
|
||||
|
||||
|
@ -302,7 +302,7 @@ char* mrmsg_get_text(const mrmsg_t* msg)
|
|||
* Typically files are associated with images, videos, audios, documents.
|
||||
* Plain text messages do not have a file.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
|
@ -310,7 +310,7 @@ char* mrmsg_get_text(const mrmsg_t* msg)
|
|||
* message. If there is no file associated with the message, an emtpy
|
||||
* string is returned. NULL is never returned and the returned value must be free()'d.
|
||||
*/
|
||||
char* mrmsg_get_file(const mrmsg_t* msg)
|
||||
char* dc_msg_get_file(const dc_msg_t* msg)
|
||||
{
|
||||
char* ret = NULL;
|
||||
|
||||
|
@ -327,9 +327,9 @@ cleanup:
|
|||
|
||||
/**
|
||||
* Get base file name without path. The base file name includes the extension; the path
|
||||
* is not returned. To get the full path, use mrmsg_get_file().
|
||||
* is not returned. To get the full path, use dc_msg_get_file().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
|
@ -337,7 +337,7 @@ cleanup:
|
|||
* associated with the message, an empty string is returned. The returned
|
||||
* value must be free()'d.
|
||||
*/
|
||||
char* mrmsg_get_filename(const mrmsg_t* msg)
|
||||
char* dc_msg_get_filename(const dc_msg_t* msg)
|
||||
{
|
||||
char* ret = NULL, *pathNfilename = NULL;
|
||||
|
||||
|
@ -363,13 +363,13 @@ cleanup:
|
|||
* If there is no associated mime type with the file, the function guesses on; if
|
||||
* in doubt, `application/octet-stream` is returned. NULL is never returned.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return String containing the mime type. Must be free()'d after usage. NULL is never returned.
|
||||
*/
|
||||
char* mrmsg_get_filemime(const mrmsg_t* msg)
|
||||
char* dc_msg_get_filemime(const dc_msg_t* msg)
|
||||
{
|
||||
char* ret = NULL;
|
||||
char* file = NULL;
|
||||
|
@ -403,13 +403,13 @@ cleanup:
|
|||
*
|
||||
* Typically, this is used to show the size of document messages, eg. a PDF.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return File size in bytes, 0 if not applicable or on errors.
|
||||
*/
|
||||
uint64_t mrmsg_get_filebytes(const mrmsg_t* msg)
|
||||
uint64_t dc_msg_get_filebytes(const dc_msg_t* msg)
|
||||
{
|
||||
uint64_t ret = 0;
|
||||
char* file = NULL;
|
||||
|
@ -434,24 +434,24 @@ cleanup:
|
|||
/**
|
||||
* Get real author and title.
|
||||
*
|
||||
* The information is returned by a mrlot_t object with the following fields:
|
||||
* The information is returned by a dc_lot_t object with the following fields:
|
||||
*
|
||||
* - mrlot_t::m_text1: Author of the media. For voice messages, this is the sender.
|
||||
* - dc_lot_t::m_text1: Author of the media. For voice messages, this is the sender.
|
||||
* For music messages, the information are read from the filename. NULL if unknown.
|
||||
*
|
||||
* - mrlot_t::m_text2: Title of the media. For voice messages, this is the date.
|
||||
* - dc_lot_t::m_text2: Title of the media. For voice messages, this is the date.
|
||||
* For music messages, the information are read from the filename. NULL if unknown.
|
||||
*
|
||||
* Currently, we do not read ID3 and such at this stage, the needed libraries are too complicated and oversized.
|
||||
* However, this is no big problem, as the sender usually sets the filename in a way we expect it.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return Media information as an mrlot_t object. Must be freed using mrlot_unref(). NULL is never returned.
|
||||
* @return Media information as an dc_lot_t object. Must be freed using dc_lot_unref(). NULL is never returned.
|
||||
*/
|
||||
mrlot_t* mrmsg_get_mediainfo(const mrmsg_t* msg)
|
||||
dc_lot_t* dc_msg_get_mediainfo(const dc_msg_t* msg)
|
||||
{
|
||||
mrlot_t* ret = mrlot_new();
|
||||
char* pathNfilename = NULL;
|
||||
|
@ -502,17 +502,17 @@ cleanup:
|
|||
* 0 is returned.
|
||||
*
|
||||
* Often the ascpect ratio is the more interesting thing. You can calculate
|
||||
* this using mrmsg_get_width() / mrmsg_get_height().
|
||||
* this using dc_msg_get_width() / dc_msg_get_height().
|
||||
*
|
||||
* See also mrmsg_get_duration().
|
||||
* See also dc_msg_get_duration().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return Width in pixels, if applicable. 0 otherwise or if unknown.
|
||||
*/
|
||||
int mrmsg_get_width(const mrmsg_t* msg)
|
||||
int dc_msg_get_width(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -527,17 +527,17 @@ int mrmsg_get_width(const mrmsg_t* msg)
|
|||
* 0 is returned.
|
||||
*
|
||||
* Often the ascpect ratio is the more interesting thing. You can calculate
|
||||
* this using mrmsg_get_width() / mrmsg_get_height().
|
||||
* this using dc_msg_get_width() / dc_msg_get_height().
|
||||
*
|
||||
* See also mrmsg_get_duration().
|
||||
* See also dc_msg_get_duration().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return Height in pixels, if applicable. 0 otherwise or if unknown.
|
||||
*/
|
||||
int mrmsg_get_height(const mrmsg_t* msg)
|
||||
int dc_msg_get_height(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -551,15 +551,15 @@ int mrmsg_get_height(const mrmsg_t* msg)
|
|||
* If the duration is unknown or if the associated file is no audio or video file,
|
||||
* 0 is returned.
|
||||
*
|
||||
* See also mrmsg_get_width() and mrmsg_get_height().
|
||||
* See also dc_msg_get_width() and dc_msg_get_height().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return Duration in milliseconds, if applicable. 0 otherwise or if unknown.
|
||||
*/
|
||||
int mrmsg_get_duration(const mrmsg_t* msg)
|
||||
int dc_msg_get_duration(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -571,13 +571,13 @@ int mrmsg_get_duration(const mrmsg_t* msg)
|
|||
/**
|
||||
* Check if a padlock should be shown beside the message.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return 1=padlock should be shown beside message, 0=do not show a padlock beside the message.
|
||||
*/
|
||||
int mrmsg_get_showpadlock(const mrmsg_t* msg)
|
||||
int dc_msg_get_showpadlock(const dc_msg_t* msg)
|
||||
{
|
||||
/* a padlock guarantees that the message is e2ee _and_ answers will be as well */
|
||||
int show_encryption_state = 0;
|
||||
|
@ -608,33 +608,33 @@ int mrmsg_get_showpadlock(const mrmsg_t* msg)
|
|||
/**
|
||||
* Get a summary for a message.
|
||||
*
|
||||
* The summary is returned by a mrlot_t object with the following fields:
|
||||
* The summary is returned by a dc_lot_t object with the following fields:
|
||||
*
|
||||
* - mrlot_t::m_text1: contains the username or the string "Me".
|
||||
* - dc_lot_t::m_text1: contains the username or the string "Me".
|
||||
* The string may be colored by having a look at m_text1_meaning.
|
||||
* If the name should not be displayed, the element is NULL.
|
||||
*
|
||||
* - mrlot_t::m_text1_meaning: one of MR_TEXT1_USERNAME or MR_TEXT1_SELF.
|
||||
* Typically used to show mrlot_t::m_text1 with different colors. 0 if not applicable.
|
||||
* - dc_lot_t::m_text1_meaning: one of DC_TEXT1_USERNAME or DC_TEXT1_SELF.
|
||||
* Typically used to show dc_lot_t::m_text1 with different colors. 0 if not applicable.
|
||||
*
|
||||
* - mrlot_t::m_text2: contains an excerpt of the message text.
|
||||
* - dc_lot_t::m_text2: contains an excerpt of the message text.
|
||||
*
|
||||
* - mrlot_t::m_timestamp: the timestamp of the message.
|
||||
* - dc_lot_t::m_timestamp: the timestamp of the message.
|
||||
*
|
||||
* - mrlot_t::m_state: The state of the message as one of the MR_STATE_* constants (see #mrmsg_get_state()).
|
||||
* - dc_lot_t::m_state: The state of the message as one of the DC_STATE_* constants (see #dc_msg_get_state()).
|
||||
*
|
||||
* Typically used to display a search result. See also mrchatlist_get_summary() to display a list of chats.
|
||||
* Typically used to display a search result. See also dc_chatlist_get_summary() to display a list of chats.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @param chat To speed up things, pass an already available chat object here.
|
||||
* If the chat object is not yet available, it is faster to pass NULL.
|
||||
*
|
||||
* @return The summary as an mrlot_t object. Must be freed using mrlot_unref(). NULL is never returned.
|
||||
* @return The summary as an dc_lot_t object. Must be freed using dc_lot_unref(). NULL is never returned.
|
||||
*/
|
||||
mrlot_t* mrmsg_get_summary(const mrmsg_t* msg, const mrchat_t* chat)
|
||||
dc_lot_t* dc_msg_get_summary(const dc_msg_t* msg, const dc_chat_t* chat)
|
||||
{
|
||||
mrlot_t* ret = mrlot_new();
|
||||
mrcontact_t* contact = NULL;
|
||||
|
@ -668,7 +668,7 @@ cleanup:
|
|||
* Get a message summary as a single line of text. Typically used for
|
||||
* notifications.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
|
@ -677,7 +677,7 @@ cleanup:
|
|||
* @return A summary for the given messages. The returned string must be free()'d.
|
||||
* Returns an empty string on errors, never returns NULL.
|
||||
*/
|
||||
char* mrmsg_get_summarytext(const mrmsg_t* msg, int approx_characters)
|
||||
char* dc_msg_get_summarytext(const dc_msg_t* msg, int approx_characters)
|
||||
{
|
||||
if( msg==NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return safe_strdup(NULL);
|
||||
|
@ -691,15 +691,15 @@ char* mrmsg_get_summarytext(const mrmsg_t* msg, int approx_characters)
|
|||
* Check if a message was sent successfully.
|
||||
*
|
||||
* Currently, "sent" messages are messages that are in the state "delivered" or "mdn received",
|
||||
* see mrmsg_get_state().
|
||||
* see dc_msg_get_state().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return 1=message sent successfully, 0=message not yet sent or message is an incoming message.
|
||||
*/
|
||||
int mrmsg_is_sent(const mrmsg_t* msg)
|
||||
int dc_msg_is_sent(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -713,16 +713,16 @@ int mrmsg_is_sent(const mrmsg_t* msg)
|
|||
* with a "star" or something like that. Starred messages can typically be shown
|
||||
* easily and are not deleted automatically.
|
||||
*
|
||||
* To star one or more messages, use mrmailbox_star_msgs(), to get a list of starred messages,
|
||||
* use mrmailbox_get_chat_msgs() using MR_CHAT_ID_STARRED as the chat_id.
|
||||
* To star one or more messages, use dc_star_msgs(), to get a list of starred messages,
|
||||
* use dc_get_chat_msgs() using DC_CHAT_ID_STARRED as the chat_id.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return 1=message is starred, 0=message not starred.
|
||||
*/
|
||||
int mrmsg_is_starred(const mrmsg_t* msg)
|
||||
int dc_msg_is_starred(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -731,7 +731,6 @@ int mrmsg_is_starred(const mrmsg_t* msg)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check if the message is a forwarded message.
|
||||
*
|
||||
|
@ -744,13 +743,13 @@ int mrmsg_is_starred(const mrmsg_t* msg)
|
|||
* "forwared"; you won't expect other data to be send to the new recipient,
|
||||
* esp. as the new recipient may not be in any relationship to the original author)
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return 1=message is a forwarded message, 0=message not forwarded.
|
||||
*/
|
||||
int mrmsg_is_forwarded(const mrmsg_t* msg)
|
||||
int dc_msg_is_forwarded(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -762,22 +761,22 @@ int mrmsg_is_forwarded(const mrmsg_t* msg)
|
|||
/**
|
||||
* Check if the message is an informational message, created by the
|
||||
* device or by another users. Such messages are not "typed" by the user but
|
||||
* created due to other actions, eg. mrmailbox_set_chat_name(), mrmailbox_set_chat_profile_image()
|
||||
* or mrmailbox_add_contact_to_chat().
|
||||
* created due to other actions, eg. dc_set_chat_name(), dc_set_chat_profile_image()
|
||||
* or dc_add_contact_to_chat().
|
||||
*
|
||||
* These messages are typically shown in the center of the chat view,
|
||||
* mrmsg_get_text() returns a descriptive text about what is going on.
|
||||
* dc_msg_get_text() returns a descriptive text about what is going on.
|
||||
*
|
||||
* There is no need to perfrom any action when seeing such a message - this is already done by the core.
|
||||
* Typically, these messages are displayed in the center of the chat.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return 1=message is a system command, 0=normal message
|
||||
*/
|
||||
int mrmsg_is_info(const mrmsg_t* msg)
|
||||
int dc_msg_is_info(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||
return 0;
|
||||
|
@ -800,18 +799,18 @@ int mrmsg_is_info(const mrmsg_t* msg)
|
|||
*
|
||||
* Setup messages should be shown in an unique way eg. using a different text color.
|
||||
* On a click or another action, the user should be prompted for the setup code
|
||||
* which is forwarded to mrmailbox_continue_key_transfer() then.
|
||||
* which is forwarded to dc_continue_key_transfer() then.
|
||||
*
|
||||
* Setup message are typically generated by mrmailbox_initiate_key_transfer() on another device.
|
||||
* Setup message are typically generated by dc_initiate_key_transfer() on another device.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return 1=message is a setup message, 0=no setup message.
|
||||
* For setup messages, mrmsg_get_type() returns MR_MSG_FILE.
|
||||
* For setup messages, dc_msg_get_type() returns DC_MSG_FILE.
|
||||
*/
|
||||
int mrmsg_is_setupmessage(const mrmsg_t* msg)
|
||||
int dc_msg_is_setupmessage(const dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC || msg->m_type != MR_MSG_FILE ) {
|
||||
return 0;
|
||||
|
@ -827,17 +826,17 @@ int mrmsg_is_setupmessage(const mrmsg_t* msg)
|
|||
* Typically, this is used to pre-fill the first entry field of the setup code.
|
||||
* If the user has several setup messages, he can be sure typing in the correct digits.
|
||||
*
|
||||
* To check, if a message is a setup message, use mrmsg_is_setupmessage().
|
||||
* To decrypt a secret key from a setup message, use mrmailbox_continue_key_transfer().
|
||||
* To check, if a message is a setup message, use dc_msg_is_setupmessage().
|
||||
* To decrypt a secret key from a setup message, use dc_continue_key_transfer().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
* @return Typically, the first two digits of the setup code or an empty string if unknown.
|
||||
* NULL is never returned. Must be free()'d when done.
|
||||
*/
|
||||
char* mrmsg_get_setupcodebegin(const mrmsg_t* msg)
|
||||
char* dc_msg_get_setupcodebegin(const dc_msg_t* msg)
|
||||
{
|
||||
char* filename = NULL;
|
||||
char* buf = NULL;
|
||||
|
@ -882,7 +881,7 @@ cleanup:
|
|||
" m.param,m.starred,m.hidden,c.blocked "
|
||||
|
||||
|
||||
static int mrmsg_set_from_stmt__(mrmsg_t* ths, sqlite3_stmt* row, int row_offset) /* field order must be MR_MSG_FIELDS */
|
||||
static int mrmsg_set_from_stmt__(dc_msg_t* ths, sqlite3_stmt* row, int row_offset) /* field order must be MR_MSG_FIELDS */
|
||||
{
|
||||
mrmsg_empty(ths);
|
||||
|
||||
|
@ -922,9 +921,9 @@ static int mrmsg_set_from_stmt__(mrmsg_t* ths, sqlite3_stmt* row, int row_offset
|
|||
*
|
||||
* Calling this function is not thread-safe, locking is up to the caller.
|
||||
*
|
||||
* @private @memberof mrmsg_t
|
||||
* @private @memberof dc_msg_t
|
||||
*/
|
||||
int mrmsg_load_from_db__(mrmsg_t* ths, mrmailbox_t* mailbox, uint32_t id)
|
||||
int mrmsg_load_from_db__(dc_msg_t* ths, mrmailbox_t* mailbox, uint32_t id)
|
||||
{
|
||||
sqlite3_stmt* stmt;
|
||||
|
||||
|
@ -955,11 +954,11 @@ int mrmsg_load_from_db__(mrmsg_t* ths, mrmailbox_t* mailbox, uint32_t id)
|
|||
/**
|
||||
* Guess message type from suffix.
|
||||
*
|
||||
* @private @memberof mrmsg_t
|
||||
* @private @memberof dc_msg_t
|
||||
*
|
||||
* @param pathNfilename Path and filename of the file to guess the type for.
|
||||
*
|
||||
* @param[out] ret_msgtype Guessed message type is copied here as one of the MR_MSG_* constants.
|
||||
* @param[out] ret_msgtype Guessed message type is copied here as one of the DC_MSG_* constants.
|
||||
* May be NULL if you're not interested in this value.
|
||||
*
|
||||
* @param[out] ret_mime The pointer to a string buffer is set to the guessed MIME-type. May be NULL. Must be free()'d by the caller.
|
||||
|
@ -1095,7 +1094,7 @@ char* mrmsg_get_summarytext_by_raw(int type, const char* text, mrparam_t* param,
|
|||
}
|
||||
|
||||
|
||||
int mrmsg_is_increation__(const mrmsg_t* msg)
|
||||
int mrmsg_is_increation__(const dc_msg_t* msg)
|
||||
{
|
||||
int is_increation = 0;
|
||||
if( MR_MSG_NEEDS_ATTACHMENT(msg->m_type) )
|
||||
|
@ -1123,14 +1122,14 @@ int mrmsg_is_increation__(const mrmsg_t* msg)
|
|||
* Typically, this is used for videos that should be recoded by the user before
|
||||
* they can be sent.
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg the message object
|
||||
*
|
||||
* @return 1=message is still in creation (`<filename>.increation` exists),
|
||||
* 0=message no longer in creation
|
||||
*/
|
||||
int mrmsg_is_increation(const mrmsg_t* msg)
|
||||
int dc_msg_is_increation(const dc_msg_t* msg)
|
||||
{
|
||||
/* surrounds mrmsg_is_increation__() with locking and error checking */
|
||||
int is_increation = 0;
|
||||
|
@ -1152,7 +1151,7 @@ int mrmsg_is_increation(const mrmsg_t* msg)
|
|||
}
|
||||
|
||||
|
||||
void mrmsg_save_param_to_disk__(mrmsg_t* msg)
|
||||
void mrmsg_save_param_to_disk__(dc_msg_t* msg)
|
||||
{
|
||||
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC || msg->m_mailbox == NULL || msg->m_mailbox->m_sql == NULL ) {
|
||||
return;
|
||||
|
@ -1175,12 +1174,12 @@ void mrmsg_save_param_to_disk__(mrmsg_t* msg)
|
|||
* If, in these cases, the frontend can provide the information, it can save
|
||||
* them together with the message object for later usage.
|
||||
*
|
||||
* This function should only be used if mrmsg_get_width(), mrmsg_get_height() or mrmsg_get_duration()
|
||||
* This function should only be used if dc_msg_get_width(), dc_msg_get_height() or dc_msg_get_duration()
|
||||
* do not provide the expected values.
|
||||
*
|
||||
* To get the stored values later, use mrmsg_get_width(), mrmsg_get_height() or mrmsg_get_duration().
|
||||
* To get the stored values later, use dc_msg_get_width(), dc_msg_get_height() or dc_msg_get_duration().
|
||||
*
|
||||
* @memberof mrmsg_t
|
||||
* @memberof dc_msg_t
|
||||
*
|
||||
* @param msg The message object.
|
||||
*
|
||||
|
@ -1192,7 +1191,7 @@ void mrmsg_save_param_to_disk__(mrmsg_t* msg)
|
|||
*
|
||||
* @return None.
|
||||
*/
|
||||
void mrmsg_latefiling_mediasize(mrmsg_t* msg, int width, int height, int duration)
|
||||
void dc_msg_latefiling_mediasize(dc_msg_t* msg, int width, int height, int duration)
|
||||
{
|
||||
int locked = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue