1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-05 19:42:04 +02:00

add a function to get the receive time of a message

This commit is contained in:
B. Petersen 2018-10-16 23:37:23 +02:00
parent 466c660fc6
commit 48eed150e5
2 changed files with 22 additions and 0 deletions

View file

@ -253,6 +253,27 @@ time_t dc_msg_get_timestamp(const dc_msg_t* msg)
}
/**
* Get message receive time.
* The receive time is returned as a unix timestamp in seconds.
*
* To get the sending time, use dc_msg_get_timestamp().
*
* @memberof dc_msg_t
* @param msg The message object.
* @return Receiving time of the message.
* For outgoing messages, 0 is returned.
*/
time_t dc_msg_get_received_timestamp(const dc_msg_t* msg)
{
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) {
return 0;
}
return msg->timestamp_rcvd;
}
/**
* Get the text of the message.
* If there is no text associated with the message, an empty string is returned.

View file

@ -500,6 +500,7 @@ uint32_t dc_msg_get_chat_id (const dc_msg_t*);
int dc_msg_get_viewtype (const dc_msg_t*);
int dc_msg_get_state (const dc_msg_t*);
time_t dc_msg_get_timestamp (const dc_msg_t*);
time_t dc_msg_get_received_timestamp(const dc_msg_t*);
char* dc_msg_get_text (const dc_msg_t*);
char* dc_msg_get_file (const dc_msg_t*);
char* dc_msg_get_filename (const dc_msg_t*);