text stringlengths 0 357 |
|---|
goto cleanup; |
} |
chat = chat_to_delete; |
} |
if (msg->from_id!=DC_CONTACT_ID_SELF && DC_CHAT_TYPE_IS_MULTI(chat->type)) { |
contact = dc_get_contact(chat->context, msg->from_id); |
} |
dc_lot_fill(ret, msg, chat, contact, msg->context); |
cleanup: |
dc_contact_unref(contact); |
dc_chat_unref(chat_to_delete); |
return ret; |
} |
/** |
* Get a message summary as a single line of text. Typically used for |
* notifications. |
* |
* @memberof dc_msg_t |
* @param msg The message object. |
* @param approx_characters Rough length of the expected string. |
* @return A summary for the given messages. The returned string must be free()'d. |
* Returns an empty string on errors, never returns NULL. |
*/ |
char* dc_msg_get_summarytext(const dc_msg_t* msg, int approx_characters) |
{ |
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) { |
return dc_strdup(NULL); |
} |
return dc_msg_get_summarytext_by_raw(msg->type, msg->text, msg->param, approx_characters, msg->context); |
} |
/** |
* Check if a message was sent successfully. |
* |
* Currently, "sent" messages are messages that are in the state "delivered" or "mdn received", |
* see dc_msg_get_state(). |
* |
* @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 dc_msg_is_sent(const dc_msg_t* msg) |
{ |
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) { |
return 0; |
} |
return (msg->state >= DC_STATE_OUT_DELIVERED)? 1 : 0; |
} |
/** |
* Check if a message is starred. Starred messages are "favorites" marked by the user |
* 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 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 dc_msg_t |
* @param msg The message object. |
* @return 1=message is starred, 0=message not starred. |
*/ |
int dc_msg_is_starred(const dc_msg_t* msg) |
{ |
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) { |
return 0; |
} |
return msg->starred? 1 : 0; |
} |
/** |
* Check if the message is a forwarded message. |
* |
* Forwarded messages may not be created by the contact given as "from". |
* |
* Typically, the UI shows a little text for a symbol above forwarded messages. |
* |
* For privacy reasons, we do not provide the name or the email address of the |
* original author (in a typical GUI, you select the messages text and click on |
* "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 dc_msg_t |
* @param msg The message object. |
* @return 1=message is a forwarded message, 0=message not forwarded. |
*/ |
int dc_msg_is_forwarded(const dc_msg_t* msg) |
{ |
if (msg==NULL || msg->magic!=DC_MSG_MAGIC) { |
return 0; |
} |
return dc_param_get_int(msg->param, DC_PARAM_FORWARDED, 0)? 1 : 0; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.