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
|
@ -854,7 +854,7 @@ EXCLUDE_PATTERNS =
|
||||||
######################################################
|
######################################################
|
||||||
EXCLUDE_SYMBOLS = mraheader_t mrapeerstate_t mrmailbox_e2ee_helper_t mrimap_t mrjob_t mrkey_t mrkeyring_t mrloginparam_t mrmime*_t
|
EXCLUDE_SYMBOLS = mraheader_t mrapeerstate_t mrmailbox_e2ee_helper_t mrimap_t mrjob_t mrkey_t mrkeyring_t mrloginparam_t mrmime*_t
|
||||||
EXCLUDE_SYMBOLS += mrsaxparser_t mrsimplify_t mrsmtp_t mrsqlite3_t mrstrbuilder_t mrparam_t mrhash_t mrhashelem_t
|
EXCLUDE_SYMBOLS += mrsaxparser_t mrsimplify_t mrsmtp_t mrsqlite3_t mrstrbuilder_t mrparam_t mrhash_t mrhashelem_t
|
||||||
EXCLUDE_SYMBOLS += _mrchat _mrchatlist _mrcontact _mrmsg _mrmailbox _mrlot _mrarray
|
EXCLUDE_SYMBOLS += _dc_chat _dc_chatlist _dc_contact _dc_msg _dc_context _dc_lot _dc_array
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
|
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
|
||||||
|
|
|
@ -173,7 +173,7 @@ typedef struct _dc_lot dc_lot_t;
|
||||||
*
|
*
|
||||||
* @memberof dc_context_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox the mailbox object as returned by dc_context_new().
|
* @param context The context object as returned by dc_context_new().
|
||||||
*
|
*
|
||||||
* @param event one of the DC_EVENT_* constants as defined in dc_event.h
|
* @param event one of the DC_EVENT_* constants as defined in dc_event.h
|
||||||
*
|
*
|
||||||
|
@ -366,7 +366,7 @@ size_t dc_chatlist_get_cnt (dc_chatlist_t*);
|
||||||
uint32_t dc_chatlist_get_chat_id (dc_chatlist_t*, size_t index);
|
uint32_t dc_chatlist_get_chat_id (dc_chatlist_t*, size_t index);
|
||||||
uint32_t dc_chatlist_get_msg_id (dc_chatlist_t*, size_t index);
|
uint32_t dc_chatlist_get_msg_id (dc_chatlist_t*, size_t index);
|
||||||
dc_lot_t* dc_chatlist_get_summary (dc_chatlist_t*, size_t index, dc_chat_t*);
|
dc_lot_t* dc_chatlist_get_summary (dc_chatlist_t*, size_t index, dc_chat_t*);
|
||||||
dc_context_t* dc_chatlist_get_mailbox (dc_chatlist_t*);
|
dc_context_t* dc_chatlist_get_context (dc_chatlist_t*);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -511,7 +511,7 @@ int dc_contact_is_verified (const dc_contact_t*);
|
||||||
* @class dc_lot_t
|
* @class dc_lot_t
|
||||||
*
|
*
|
||||||
* An object containing a set of values. The meaning of the values is defined by the function returning the set object.
|
* An object containing a set of values. The meaning of the values is defined by the function returning the set object.
|
||||||
* Set objects are created eg. by mrchatlist_get_summary(), mrmsg_get_summary() or by mrmsg_get_mediainfo().
|
* Set objects are created eg. by dc_chatlist_get_summary(), dc_msg_get_summary() or by dc_msg_get_mediainfo().
|
||||||
*
|
*
|
||||||
* NB: _Lot_ is used in the meaning _heap_ here.
|
* NB: _Lot_ is used in the meaning _heap_ here.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,14 +29,14 @@
|
||||||
/**
|
/**
|
||||||
* Create an array object in memory.
|
* Create an array object in memory.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object that should be stored in the array object. May be NULL.
|
* @param mailbox The mailbox object that should be stored in the array object. May be NULL.
|
||||||
* @param initsize Initial maximal size of the array. If you add more items, the internal data pointer is reallocated.
|
* @param initsize Initial maximal size of the array. If you add more items, the internal data pointer is reallocated.
|
||||||
*
|
*
|
||||||
* @return New array object of the requested size, the data should be set directly.
|
* @return New array object of the requested size, the data should be set directly.
|
||||||
*/
|
*/
|
||||||
mrarray_t* mrarray_new(mrmailbox_t* mailbox, size_t initsize)
|
dc_array_t* dc_array_new(dc_context_t* mailbox, size_t initsize)
|
||||||
{
|
{
|
||||||
mrarray_t* array;
|
mrarray_t* array;
|
||||||
|
|
||||||
|
@ -61,14 +61,14 @@ mrarray_t* mrarray_new(mrmailbox_t* mailbox, size_t initsize)
|
||||||
/**
|
/**
|
||||||
* Free an array object. Does not free any data items.
|
* Free an array object. Does not free any data items.
|
||||||
*
|
*
|
||||||
* @memberof mrarray_t
|
* @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object to free, created eg. by mrmailbox_get_chatlist(), mrmailbox_get_contacts() and so on.
|
* @param array The array object to free, created eg. by dc_get_chatlist(), dc_get_contacts() and so on.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void mrarray_unref(mrarray_t* array)
|
void dc_array_unref(dc_array_t* array)
|
||||||
{
|
{
|
||||||
if( array==NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
if( array==NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -84,14 +84,14 @@ void mrarray_unref(mrarray_t* array)
|
||||||
* Calls free() for each item and sets the item to 0 afterwards.
|
* Calls free() for each item and sets the item to 0 afterwards.
|
||||||
* The array object itself is not deleted and the size of the array stays the same.
|
* The array object itself is not deleted and the size of the array stays the same.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void mrarray_free_ptr(mrarray_t* array)
|
void mrarray_free_ptr(dc_array_t* array)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ void mrarray_free_ptr(mrarray_t* array)
|
||||||
* Duplicates the array, take care if the array contains pointers to objects, take care to free them only once afterwards!
|
* Duplicates the array, take care if the array contains pointers to objects, take care to free them only once afterwards!
|
||||||
* If the array only contains integers, you are always save.
|
* If the array only contains integers, you are always save.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
*
|
*
|
||||||
* @return The duplicated array.
|
* @return The duplicated array.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
mrarray_t* mrarray_duplicate(const mrarray_t* array)
|
mrarray_t* mrarray_duplicate(const dc_array_t* array)
|
||||||
{
|
{
|
||||||
mrarray_t* ret = NULL;
|
mrarray_t* ret = NULL;
|
||||||
|
|
||||||
|
@ -143,14 +143,14 @@ static int cmp_intptr_t(const void* p1, const void* p2)
|
||||||
/**
|
/**
|
||||||
* Sort the array, assuming it contains unsigned integers.
|
* Sort the array, assuming it contains unsigned integers.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
*
|
*
|
||||||
* @return The duplicated array.
|
* @return The duplicated array.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void mrarray_sort_ids(mrarray_t* array)
|
void mrarray_sort_ids(dc_array_t* array)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || array->m_count <= 1 ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || array->m_count <= 1 ) {
|
||||||
return;
|
return;
|
||||||
|
@ -170,14 +170,14 @@ static int cmp_strings_t(const void* p1, const void* p2)
|
||||||
/**
|
/**
|
||||||
* Sort the array, assuming it contains pointers to strings.
|
* Sort the array, assuming it contains pointers to strings.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
*
|
*
|
||||||
* @return The duplicated array.
|
* @return The duplicated array.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void mrarray_sort_strings(mrarray_t* array)
|
void mrarray_sort_strings(dc_array_t* array)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || array->m_count <= 1 ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || array->m_count <= 1 ) {
|
||||||
return;
|
return;
|
||||||
|
@ -189,13 +189,13 @@ void mrarray_sort_strings(mrarray_t* array)
|
||||||
/**
|
/**
|
||||||
* Empty an array object. Allocated data is not freed by this function, only the count is set to null.
|
* Empty an array object. Allocated data is not freed by this function, only the count is set to null.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object to empty.
|
* @param array The array object to empty.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrarray_empty(mrarray_t* array)
|
void dc_array_empty(dc_array_t* array)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -216,7 +216,7 @@ void mrarray_empty(mrarray_t* array)
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrarray_add_uint(mrarray_t* array, uintptr_t item)
|
void dc_array_add_uint(dc_array_t* array, uintptr_t item)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -246,7 +246,7 @@ void mrarray_add_uint(mrarray_t* array, uintptr_t item)
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrarray_add_id(mrarray_t* array, uint32_t item)
|
void dc_array_add_id(dc_array_t* array, uint32_t item)
|
||||||
{
|
{
|
||||||
mrarray_add_uint(array, item);
|
mrarray_add_uint(array, item);
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ void mrarray_add_id(mrarray_t* array, uint32_t item)
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrarray_add_ptr(mrarray_t* array, void* item)
|
void dc_array_add_ptr(dc_array_t* array, void* item)
|
||||||
{
|
{
|
||||||
mrarray_add_uint(array, (uintptr_t)item);
|
mrarray_add_uint(array, (uintptr_t)item);
|
||||||
}
|
}
|
||||||
|
@ -272,13 +272,13 @@ void mrarray_add_ptr(mrarray_t* array, void* item)
|
||||||
/**
|
/**
|
||||||
* Find out the number of items in an array.
|
* Find out the number of items in an array.
|
||||||
*
|
*
|
||||||
* @memberof mrarray_t
|
* @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
*
|
*
|
||||||
* @return Returns the number of items in a mrarray_t object. 0 on errors or if the array is empty.
|
* @return Returns the number of items in a dc_array_t object. 0 on errors or if the array is empty.
|
||||||
*/
|
*/
|
||||||
size_t mrarray_get_cnt(const mrarray_t* array)
|
size_t dc_array_get_cnt(const dc_array_t* array)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -292,14 +292,14 @@ size_t mrarray_get_cnt(const mrarray_t* array)
|
||||||
* Get the item at the given index as an unsigned integer.
|
* Get the item at the given index as an unsigned integer.
|
||||||
* The size of the integer is always larget enough to hold a pointer.
|
* The size of the integer is always larget enough to hold a pointer.
|
||||||
*
|
*
|
||||||
* @memberof mrarray_t
|
* @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
* @param index Index of the item to get. Must be between 0 and mrarray_get_cnt()-1.
|
* @param index Index of the item to get. Must be between 0 and dc_array_get_cnt()-1.
|
||||||
*
|
*
|
||||||
* @return Returns the item at the given index. Returns 0 on errors or if the array is empty.
|
* @return Returns the item at the given index. Returns 0 on errors or if the array is empty.
|
||||||
*/
|
*/
|
||||||
uintptr_t mrarray_get_uint(const mrarray_t* array, size_t index)
|
uintptr_t dc_array_get_uint(const dc_array_t* array, size_t index)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -312,14 +312,14 @@ uintptr_t mrarray_get_uint(const mrarray_t* array, size_t index)
|
||||||
/**
|
/**
|
||||||
* Get the item at the given index as an ID.
|
* Get the item at the given index as an ID.
|
||||||
*
|
*
|
||||||
* @memberof mrarray_t
|
* @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
* @param index Index of the item to get. Must be between 0 and mrarray_get_cnt()-1.
|
* @param index Index of the item to get. Must be between 0 and dc_array_get_cnt()-1.
|
||||||
*
|
*
|
||||||
* @return Returns the item at the given index. Returns 0 on errors or if the array is empty.
|
* @return Returns the item at the given index. Returns 0 on errors or if the array is empty.
|
||||||
*/
|
*/
|
||||||
uint32_t mrarray_get_id(const mrarray_t* array, size_t index)
|
uint32_t dc_array_get_id(const dc_array_t* array, size_t index)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -332,14 +332,14 @@ uint32_t mrarray_get_id(const mrarray_t* array, size_t index)
|
||||||
/**
|
/**
|
||||||
* Get the item at the given index as an ID.
|
* Get the item at the given index as an ID.
|
||||||
*
|
*
|
||||||
* @memberof mrarray_t
|
* @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
* @param index Index of the item to get. Must be between 0 and mrarray_get_cnt()-1.
|
* @param index Index of the item to get. Must be between 0 and dc_array_get_cnt()-1.
|
||||||
*
|
*
|
||||||
* @return Returns the item at the given index. Returns 0 on errors or if the array is empty.
|
* @return Returns the item at the given index. Returns 0 on errors or if the array is empty.
|
||||||
*/
|
*/
|
||||||
void* mrarray_get_ptr(const mrarray_t* array, size_t index)
|
void* dc_array_get_ptr(const dc_array_t* array, size_t index)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC || index < 0 || index >= array->m_count ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -352,7 +352,7 @@ void* mrarray_get_ptr(const mrarray_t* array, size_t index)
|
||||||
/**
|
/**
|
||||||
* Check if a given ID is present in an array.
|
* Check if a given ID is present in an array.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object to search in.
|
* @param array The array object to search in.
|
||||||
* @param needle The ID to search for.
|
* @param needle The ID to search for.
|
||||||
|
@ -360,7 +360,7 @@ void* mrarray_get_ptr(const mrarray_t* array, size_t index)
|
||||||
*
|
*
|
||||||
* @return 1=ID is present in array, 0=ID not found.
|
* @return 1=ID is present in array, 0=ID not found.
|
||||||
*/
|
*/
|
||||||
int mrarray_search_id(const mrarray_t* array, uint32_t needle, size_t* ret_index)
|
int dc_array_search_id(const dc_array_t* array, uint32_t needle, size_t* ret_index)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -385,14 +385,14 @@ int mrarray_search_id(const mrarray_t* array, uint32_t needle, size_t* ret_index
|
||||||
/**
|
/**
|
||||||
* Get raw pointer to the data.
|
* Get raw pointer to the data.
|
||||||
*
|
*
|
||||||
* @private @memberof mrarray_t
|
* @private @memberof dc_array_t
|
||||||
*
|
*
|
||||||
* @param array The array object.
|
* @param array The array object.
|
||||||
*
|
*
|
||||||
* @return Raw pointer to the array. You MUST NOT free the data. You MUST NOT access the data beyond the current item count.
|
* @return Raw pointer to the array. You MUST NOT free the data. You MUST NOT access the data beyond the current item count.
|
||||||
* It is not possible to enlarge the array this way. Calling any other mrarray-function may discard the returned pointer.
|
* It is not possible to enlarge the array this way. Calling any other dc_array-function may discard the returned pointer.
|
||||||
*/
|
*/
|
||||||
const uintptr_t* mrarray_get_raw(const mrarray_t* array)
|
const uintptr_t* dc_array_get_raw(const dc_array_t* array)
|
||||||
{
|
{
|
||||||
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
if( array == NULL || array->m_magic != MR_ARRAY_MAGIC ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -431,7 +431,7 @@ char* mr_arr_to_string(const uint32_t* arr, int cnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* mrarray_get_string(const mrarray_t* array, const char* sep)
|
char* mrarray_get_string(const dc_array_t* array, const char* sep)
|
||||||
{
|
{
|
||||||
char* ret = NULL;
|
char* ret = NULL;
|
||||||
|
|
||||||
|
|
125
src/mrchat.c
125
src/mrchat.c
|
@ -33,17 +33,17 @@
|
||||||
/**
|
/**
|
||||||
* Create a chat object in memory.
|
* Create a chat object in memory.
|
||||||
*
|
*
|
||||||
* @private @memberof mrchat_t
|
* @private @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object that should be stored in the chat object.
|
* @param mailbox The mailbox object that should be stored in the chat object.
|
||||||
*
|
*
|
||||||
* @return New and empty chat object, must be freed using mrchat_unref().
|
* @return New and empty chat object, must be freed using dc_chat_unref().
|
||||||
*/
|
*/
|
||||||
mrchat_t* mrchat_new(mrmailbox_t* mailbox)
|
dc_chat_t* dc_chat_new(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
mrchat_t* ths = NULL;
|
dc_chat_t* ths = NULL;
|
||||||
|
|
||||||
if( mailbox == NULL || (ths=calloc(1, sizeof(mrchat_t)))==NULL ) {
|
if( mailbox == NULL || (ths=calloc(1, sizeof(dc_chat_t)))==NULL ) {
|
||||||
exit(14); /* cannot allocate little memory, unrecoverable error */
|
exit(14); /* cannot allocate little memory, unrecoverable error */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ mrchat_t* mrchat_new(mrmailbox_t* mailbox)
|
||||||
/**
|
/**
|
||||||
* Free a chat object.
|
* Free a chat object.
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat Chat object are returned eg. by mrmailbox_get_chat().
|
* @param chat Chat object are returned eg. by dc_get_chat().
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrchat_unref(mrchat_t* chat)
|
void dc_chat_unref(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat==NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat==NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -81,13 +81,13 @@ void mrchat_unref(mrchat_t* chat)
|
||||||
/**
|
/**
|
||||||
* Empty a chat object.
|
* Empty a chat object.
|
||||||
*
|
*
|
||||||
* @private @memberof mrchat_t
|
* @private @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object to empty.
|
* @param chat The chat object to empty.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrchat_empty(mrchat_t* chat)
|
void dc_chat_empty(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -122,19 +122,19 @@ void mrchat_empty(mrchat_t* chat)
|
||||||
* Get chat ID. The chat ID is the ID under which the chat is filed in the database.
|
* Get chat ID. The chat ID is the ID under which the chat is filed in the database.
|
||||||
*
|
*
|
||||||
* Special IDs:
|
* Special IDs:
|
||||||
* - MR_CHAT_ID_DEADDROP (1) - Virtual chat containing messages which senders are not confirmed by the user.
|
* - DC_CHAT_ID_DEADDROP (1) - Virtual chat containing messages which senders are not confirmed by the user.
|
||||||
* - MR_CHAT_ID_STARRED (5) - Virtual chat containing all starred messages-
|
* - DC_CHAT_ID_STARRED (5) - Virtual chat containing all starred messages-
|
||||||
* - MR_CHAT_ID_ARCHIVED_LINK (6) - A link at the end of the chatlist, if present the UI should show the button "Archived chats"-
|
* - DC_CHAT_ID_ARCHIVED_LINK (6) - A link at the end of the chatlist, if present the UI should show the button "Archived chats"-
|
||||||
*
|
*
|
||||||
* "Normal" chat IDs are larger than these special IDs (larger than MR_CHAT_ID_LAST_SPECIAL).
|
* "Normal" chat IDs are larger than these special IDs (larger than DC_CHAT_ID_LAST_SPECIAL).
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Chat ID. 0 on errors.
|
* @return Chat ID. 0 on errors.
|
||||||
*/
|
*/
|
||||||
uint32_t mrchat_get_id(mrchat_t* chat)
|
uint32_t dc_chat_get_id(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -149,24 +149,23 @@ uint32_t mrchat_get_id(mrchat_t* chat)
|
||||||
*
|
*
|
||||||
* Currently, there are two chat types:
|
* Currently, there are two chat types:
|
||||||
*
|
*
|
||||||
* - MR_CHAT_TYPE_SINGLE (100) - a normal chat is a chat with a single contact,
|
* - DC_CHAT_TYPE_SINGLE (100) - a normal chat is a chat with a single contact,
|
||||||
* chats_contacts contains one record for the user. MR_CONTACT_ID_SELF
|
* chats_contacts contains one record for the user. DC_CONTACT_ID_SELF
|
||||||
* (see mrcontact_t::m_id) is added _only_ for a self talk; in addition to
|
* (see dc_contact_t::m_id) is added _only_ for a self talk.
|
||||||
* this, for self talks also the flag MRP_SELFTALK is set.
|
|
||||||
*
|
*
|
||||||
* - MR_CHAT_TYPE_GROUP (120) - a group chat, chats_contacts conain all group
|
* - DC_CHAT_TYPE_GROUP (120) - a group chat, chats_contacts conain all group
|
||||||
* members, incl. MR_CONTACT_ID_SELF
|
* members, incl. DC_CONTACT_ID_SELF
|
||||||
*
|
*
|
||||||
* - MR_CHAT_TYPE_VERIFIED_GROUP (130) - a verified group chat. In verified groups,
|
* - DC_CHAT_TYPE_VERIFIED_GROUP (130) - a verified group chat. In verified groups,
|
||||||
* all members are verified and encryption is always active and cannot be disabled.
|
* all members are verified and encryption is always active and cannot be disabled.
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Chat type.
|
* @return Chat type.
|
||||||
*/
|
*/
|
||||||
int mrchat_get_type(mrchat_t* chat)
|
int dc_chat_get_type(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return MR_CHAT_TYPE_UNDEFINED;
|
return MR_CHAT_TYPE_UNDEFINED;
|
||||||
|
@ -177,20 +176,20 @@ int mrchat_get_type(mrchat_t* chat)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name of a chat. For one-to-one chats, this is the name of the contact.
|
* Get name of a chat. For one-to-one chats, this is the name of the contact.
|
||||||
* For group chats, this is the name given eg. to mrmailbox_create_group_chat() or
|
* For group chats, this is the name given eg. to dc_create_group_chat() or
|
||||||
* received by a group-creation message.
|
* received by a group-creation message.
|
||||||
*
|
*
|
||||||
* To change the name, use mrmailbox_set_chat_name()
|
* To change the name, use dc_set_chat_name()
|
||||||
*
|
*
|
||||||
* See also: mrchat_get_subtitle()
|
* See also: dc_chat_get_subtitle()
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Chat name as a string. Must be free()'d after usage. Never NULL.
|
* @return Chat name as a string. Must be free()'d after usage. Never NULL.
|
||||||
*/
|
*/
|
||||||
char* mrchat_get_name(mrchat_t* chat)
|
char* dc_chat_get_name(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return safe_strdup("Err");
|
return safe_strdup("Err");
|
||||||
|
@ -204,15 +203,15 @@ char* mrchat_get_name(mrchat_t* chat)
|
||||||
* Get a subtitle for a chat. The subtitle is eg. the email-address or the
|
* Get a subtitle for a chat. The subtitle is eg. the email-address or the
|
||||||
* number of group members.
|
* number of group members.
|
||||||
*
|
*
|
||||||
* See also: mrchat_get_name()
|
* See also: dc_chat_get_name()
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object to calulate the subtitle for.
|
* @param chat The chat object to calulate the subtitle for.
|
||||||
*
|
*
|
||||||
* @return Subtitle as a string. Must be free()'d after usage. Never NULL.
|
* @return Subtitle as a string. Must be free()'d after usage. Never NULL.
|
||||||
*/
|
*/
|
||||||
char* mrchat_get_subtitle(mrchat_t* chat)
|
char* dc_chat_get_subtitle(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
/* returns either the address or the number of chat members */
|
/* returns either the address or the number of chat members */
|
||||||
char* ret = NULL;
|
char* ret = NULL;
|
||||||
|
@ -268,17 +267,17 @@ char* mrchat_get_subtitle(mrchat_t* chat)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the chat's profile image.
|
* Get the chat's profile image.
|
||||||
* The profile image is set using mrmailbox_set_chat_profile_image() for groups.
|
* The profile image is set using dc_set_chat_profile_image() for groups.
|
||||||
* For normal chats, the profile image is set using mrmailbox_set_contact_profile_image() (not yet implemented).
|
* For normal chats, the profile image is set using dc_set_contact_profile_image() (not yet implemented).
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Path and file if the profile image, if any. NULL otherwise.
|
* @return Path and file if the profile image, if any. NULL otherwise.
|
||||||
* Must be free()'d after usage.
|
* Must be free()'d after usage.
|
||||||
*/
|
*/
|
||||||
char* mrchat_get_profile_image(mrchat_t* chat)
|
char* dc_chat_get_profile_image(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -290,18 +289,18 @@ char* mrchat_get_profile_image(mrchat_t* chat)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get draft for the chat, if any. A draft is a message that the user started to
|
* Get draft for the chat, if any. A draft is a message that the user started to
|
||||||
* compose but that is not sent yet. You can save a draft for a chat using mrmailbox_set_draft().
|
* compose but that is not sent yet. You can save a draft for a chat using dc_set_draft().
|
||||||
*
|
*
|
||||||
* Drafts are considered when sorting messages and are also returned eg.
|
* Drafts are considered when sorting messages and are also returned eg.
|
||||||
* by mrchatlist_get_summary().
|
* by dc_chatlist_get_summary().
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Draft text, must be free()'d. Returns NULL if there is no draft.
|
* @return Draft text, must be free()'d. Returns NULL if there is no draft.
|
||||||
*/
|
*/
|
||||||
char* mrchat_get_draft(mrchat_t* chat)
|
char* dc_chat_get_draft(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -314,15 +313,15 @@ char* mrchat_get_draft(mrchat_t* chat)
|
||||||
/**
|
/**
|
||||||
* Get timestamp of the draft.
|
* Get timestamp of the draft.
|
||||||
*
|
*
|
||||||
* The draft itself can be get using mrchat_get_draft().
|
* The draft itself can be get using dc_chat_get_draft().
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Timestamp of the draft. 0 if there is no draft.
|
* @return Timestamp of the draft. 0 if there is no draft.
|
||||||
*/
|
*/
|
||||||
time_t mrchat_get_draft_timestamp(mrchat_t* chat)
|
time_t dc_chat_get_draft_timestamp(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -338,17 +337,17 @@ time_t mrchat_get_draft_timestamp(mrchat_t* chat)
|
||||||
* - 1 = chat archived
|
* - 1 = chat archived
|
||||||
* - 2 = chat sticky (reserved for future use, if you do not support this value, just treat the chat as a normal one)
|
* - 2 = chat sticky (reserved for future use, if you do not support this value, just treat the chat as a normal one)
|
||||||
*
|
*
|
||||||
* To archive or unarchive chats, use mrmailbox_archive_chat().
|
* To archive or unarchive chats, use dc_archive_chat().
|
||||||
* If chats are archived, this should be shown in the UI by a little icon or text,
|
* If chats are archived, this should be shown in the UI by a little icon or text,
|
||||||
* eg. the search will also return archived chats.
|
* eg. the search will also return archived chats.
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return Archived state.
|
* @return Archived state.
|
||||||
*/
|
*/
|
||||||
int mrchat_get_archived(mrchat_t* chat)
|
int dc_chat_get_archived(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -362,17 +361,17 @@ int mrchat_get_archived(mrchat_t* chat)
|
||||||
* message is sent. With unpromoted chats, members can be sent, settings can be
|
* message is sent. With unpromoted chats, members can be sent, settings can be
|
||||||
* modified without the need of special status messages being sent.
|
* modified without the need of special status messages being sent.
|
||||||
*
|
*
|
||||||
* After the creation with mrmailbox_create_group_chat() the chat is usuall unpromoted
|
* After the creation with dc_create_group_chat() the chat is usuall unpromoted
|
||||||
* until the first call to mrmailbox_send_msg() or mrmailbox_send_text_msg().
|
* until the first call to dc_send_msg() or dc_send_text_msg().
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return 1=chat is still unpromoted, no message was ever send to the chat,
|
* @return 1=chat is still unpromoted, no message was ever send to the chat,
|
||||||
* 0=chat is not unpromoted, messages were send and/or received
|
* 0=chat is not unpromoted, messages were send and/or received
|
||||||
*/
|
*/
|
||||||
int mrchat_is_unpromoted(mrchat_t* chat)
|
int dc_chat_is_unpromoted(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -384,15 +383,15 @@ int mrchat_is_unpromoted(mrchat_t* chat)
|
||||||
/**
|
/**
|
||||||
* Check if a chat is verified. Verified chats contain only verified members
|
* Check if a chat is verified. Verified chats contain only verified members
|
||||||
* and encryption is alwasy enabled. Verified chats are created using
|
* and encryption is alwasy enabled. Verified chats are created using
|
||||||
* mrmailbox_create_group_chat() by setting the 'verified' parameter to true.
|
* dc_create_group_chat() by setting the 'verified' parameter to true.
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return 1=chat verified, 0=chat is not verified
|
* @return 1=chat verified, 0=chat is not verified
|
||||||
*/
|
*/
|
||||||
int mrchat_is_verified(mrchat_t* chat)
|
int dc_chat_is_verified(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -401,7 +400,7 @@ int mrchat_is_verified(mrchat_t* chat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mrchat_are_all_members_verified__(mrchat_t* chat)
|
int mrchat_are_all_members_verified__(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
int chat_verified = 0;
|
int chat_verified = 0;
|
||||||
sqlite3_stmt* stmt;
|
sqlite3_stmt* stmt;
|
||||||
|
@ -441,15 +440,15 @@ cleanup:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a chat is a self talk. Self talks are normal chats with
|
* Check if a chat is a self talk. Self talks are normal chats with
|
||||||
* the only contact MR_CONTACT_ID_SELF.
|
* the only contact DC_CONTACT_ID_SELF.
|
||||||
*
|
*
|
||||||
* @memberof mrchat_t
|
* @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
*
|
*
|
||||||
* @return 1=chat is self talk, 0=chat is no self talk
|
* @return 1=chat is self talk, 0=chat is no self talk
|
||||||
*/
|
*/
|
||||||
int mrchat_is_self_talk(mrchat_t* chat)
|
int dc_chat_is_self_talk(dc_chat_t* chat)
|
||||||
{
|
{
|
||||||
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
if( chat == NULL || chat->m_magic != MR_CHAT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -463,7 +462,7 @@ int mrchat_is_self_talk(mrchat_t* chat)
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
int mrchat_update_param__(mrchat_t* ths)
|
int mrchat_update_param__(dc_chat_t* ths)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
sqlite3_stmt* stmt = mrsqlite3_prepare_v2_(ths->m_mailbox->m_sql, "UPDATE chats SET param=? WHERE id=?");
|
sqlite3_stmt* stmt = mrsqlite3_prepare_v2_(ths->m_mailbox->m_sql, "UPDATE chats SET param=? WHERE id=?");
|
||||||
|
@ -475,7 +474,7 @@ int mrchat_update_param__(mrchat_t* ths)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int mrchat_set_from_stmt__(mrchat_t* ths, sqlite3_stmt* row)
|
static int mrchat_set_from_stmt__(dc_chat_t* ths, sqlite3_stmt* row)
|
||||||
{
|
{
|
||||||
int row_offset = 0;
|
int row_offset = 0;
|
||||||
const char* draft_text;
|
const char* draft_text;
|
||||||
|
@ -535,16 +534,16 @@ static int mrchat_set_from_stmt__(mrchat_t* ths, sqlite3_stmt* row)
|
||||||
*
|
*
|
||||||
* Calling this function is not thread-safe, locking is up to the caller.
|
* Calling this function is not thread-safe, locking is up to the caller.
|
||||||
*
|
*
|
||||||
* @private @memberof mrchat_t
|
* @private @memberof dc_chat_t
|
||||||
*
|
*
|
||||||
* @param chat The chat object that should be filled with the data from the database.
|
* @param chat The chat object that should be filled with the data from the database.
|
||||||
* Existing data are free()'d before using mrchat_empty().
|
* Existing data are free()'d before using dc_chat_empty().
|
||||||
*
|
*
|
||||||
* @param chat_id Chat ID that should be loaded from the database.
|
* @param chat_id Chat ID that should be loaded from the database.
|
||||||
*
|
*
|
||||||
* @return 1=success, 0=error.
|
* @return 1=success, 0=error.
|
||||||
*/
|
*/
|
||||||
int mrchat_load_from_db__(mrchat_t* chat, uint32_t chat_id)
|
int mrchat_load_from_db__(dc_chat_t* chat, uint32_t chat_id)
|
||||||
{
|
{
|
||||||
sqlite3_stmt* stmt;
|
sqlite3_stmt* stmt;
|
||||||
|
|
||||||
|
|
|
@ -28,17 +28,17 @@
|
||||||
/**
|
/**
|
||||||
* Create a chatlist object in memory.
|
* Create a chatlist object in memory.
|
||||||
*
|
*
|
||||||
* @private @memberof mrchatlist_t
|
* @private @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object that should be stored in the chatlist object.
|
* @param mailbox The mailbox object that should be stored in the chatlist object.
|
||||||
*
|
*
|
||||||
* @return New and empty chatlist object, must be freed using mrchatlist_unref().
|
* @return New and empty chatlist object, must be freed using dc_chatlist_unref().
|
||||||
*/
|
*/
|
||||||
mrchatlist_t* mrchatlist_new(mrmailbox_t* mailbox)
|
dc_chatlist_t* dc_chatlist_new(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
mrchatlist_t* ths = NULL;
|
dc_chatlist_t* ths = NULL;
|
||||||
|
|
||||||
if( (ths=calloc(1, sizeof(mrchatlist_t)))==NULL ) {
|
if( (ths=calloc(1, sizeof(dc_chatlist_t)))==NULL ) {
|
||||||
exit(20);
|
exit(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,14 +55,14 @@ mrchatlist_t* mrchatlist_new(mrmailbox_t* mailbox)
|
||||||
/**
|
/**
|
||||||
* Free a chatlist object.
|
* Free a chatlist object.
|
||||||
*
|
*
|
||||||
* @memberof mrchatlist_t
|
* @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist object to free, created eg. by mrmailbox_get_chatlist(), mrmailbox_search_msgs().
|
* @param chatlist The chatlist object to free, created eg. by dc_get_chatlist(), dc_search_msgs().
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void mrchatlist_unref(mrchatlist_t* chatlist)
|
void dc_chatlist_unref(dc_chatlist_t* chatlist)
|
||||||
{
|
{
|
||||||
if( chatlist==NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
if( chatlist==NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -78,13 +78,13 @@ void mrchatlist_unref(mrchatlist_t* chatlist)
|
||||||
/**
|
/**
|
||||||
* Empty a chatlist object.
|
* Empty a chatlist object.
|
||||||
*
|
*
|
||||||
* @private @memberof mrchatlist_t
|
* @private @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist object to empty.
|
* @param chatlist The chatlist object to empty.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrchatlist_empty(mrchatlist_t* chatlist)
|
void dc_chatlist_empty(dc_chatlist_t* chatlist)
|
||||||
{
|
{
|
||||||
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -98,13 +98,13 @@ void mrchatlist_empty(mrchatlist_t* chatlist)
|
||||||
/**
|
/**
|
||||||
* Find out the number of chats in a chatlist.
|
* Find out the number of chats in a chatlist.
|
||||||
*
|
*
|
||||||
* @memberof mrchatlist_t
|
* @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist().
|
* @param chatlist The chatlist object as created eg. by dc_get_chatlist().
|
||||||
*
|
*
|
||||||
* @return Returns the number of items in a mrchatlist_t object. 0 on errors or if the list is empty.
|
* @return Returns the number of items in a dc_chatlist_t object. 0 on errors or if the list is empty.
|
||||||
*/
|
*/
|
||||||
size_t mrchatlist_get_cnt(mrchatlist_t* chatlist)
|
size_t dc_chatlist_get_cnt(dc_chatlist_t* chatlist)
|
||||||
{
|
{
|
||||||
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -117,18 +117,18 @@ size_t mrchatlist_get_cnt(mrchatlist_t* chatlist)
|
||||||
/**
|
/**
|
||||||
* Get a single chat ID of a chatlist.
|
* Get a single chat ID of a chatlist.
|
||||||
*
|
*
|
||||||
* To get the message object from the message ID, use mrmailbox_get_chat().
|
* To get the message object from the message ID, use dc_get_chat().
|
||||||
*
|
*
|
||||||
* @memberof mrchatlist_t
|
* @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist().
|
* @param chatlist The chatlist object as created eg. by dc_get_chatlist().
|
||||||
*
|
*
|
||||||
* @param index The index to get the chat ID for.
|
* @param index The index to get the chat ID for.
|
||||||
*
|
*
|
||||||
* @return Returns the chat_id of the item at the given index. Index must be between
|
* @return Returns the chat_id of the item at the given index. Index must be between
|
||||||
* 0 and mrchatlist_get_cnt()-1.
|
* 0 and dc_chatlist_get_cnt()-1.
|
||||||
*/
|
*/
|
||||||
uint32_t mrchatlist_get_chat_id(mrchatlist_t* chatlist, size_t index)
|
uint32_t dc_chatlist_get_chat_id(dc_chatlist_t* chatlist, size_t index)
|
||||||
{
|
{
|
||||||
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
|
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -141,18 +141,18 @@ uint32_t mrchatlist_get_chat_id(mrchatlist_t* chatlist, size_t index)
|
||||||
/**
|
/**
|
||||||
* Get a single message ID of a chatlist.
|
* Get a single message ID of a chatlist.
|
||||||
*
|
*
|
||||||
* To get the message object from the message ID, use mrmailbox_get_msg().
|
* To get the message object from the message ID, use dc_get_msg().
|
||||||
*
|
*
|
||||||
* @memberof mrchatlist_t
|
* @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist object as created eg. by mrmailbox_get_chatlist().
|
* @param chatlist The chatlist object as created eg. by dc_get_chatlist().
|
||||||
*
|
*
|
||||||
* @param index The index to get the chat ID for.
|
* @param index The index to get the chat ID for.
|
||||||
*
|
*
|
||||||
* @return Returns the message_id of the item at the given index. Index must be between
|
* @return 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.
|
* 0 and dc_chatlist_get_cnt()-1. If there is no message at the given index (eg. the chat may be empty), 0 is returned.
|
||||||
*/
|
*/
|
||||||
uint32_t mrchatlist_get_msg_id(mrchatlist_t* chatlist, size_t index)
|
uint32_t dc_chatlist_get_msg_id(dc_chatlist_t* chatlist, size_t index)
|
||||||
{
|
{
|
||||||
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
|
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC || chatlist->m_chatNlastmsg_ids == NULL || index >= chatlist->m_cnt ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -165,32 +165,32 @@ uint32_t mrchatlist_get_msg_id(mrchatlist_t* chatlist, size_t index)
|
||||||
/**
|
/**
|
||||||
* Get a summary for a chatlist index.
|
* Get a summary for a chatlist index.
|
||||||
*
|
*
|
||||||
* 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 strings "Me", "Draft" and so on.
|
* - dc_lot_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.
|
* 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.
|
* 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.
|
* - dc_lot_t::m_text1_meaning: one of DC_TEXT1_USERNAME, DC_TEXT1_SELF or DC_TEXT1_DRAFT.
|
||||||
* Typically used to show mrlot_t::m_text1 with different colors. 0 if not applicable.
|
* 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 or strings as
|
* - dc_lot_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)
|
* "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.
|
* - dc_lot_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.
|
* - dc_lot_t::m_state: The state of the message as one of the DC_STATE_* constants (see #dc_msg_get_state()). 0 if not applicable.
|
||||||
*
|
*
|
||||||
* @memberof mrchatlist_t
|
* @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist to query as returned eg. from mrmailbox_get_chatlist().
|
* @param chatlist The chatlist to query as returned eg. from dc_get_chatlist().
|
||||||
* @param index The index to query in the chatlist.
|
* @param index The index to query in the chatlist.
|
||||||
* @param chat To speed up things, pass an already available chat object here.
|
* @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.
|
* 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* mrchatlist_get_summary(mrchatlist_t* chatlist, size_t index, mrchat_t* chat /*may be NULL*/)
|
dc_lot_t* dc_chatlist_get_summary(dc_chatlist_t* chatlist, size_t index, dc_chat_t* chat /*may be NULL*/)
|
||||||
{
|
{
|
||||||
/* The summary is created by the chat, not by the last message.
|
/* The summary is created by the chat, not by the last message.
|
||||||
This is because we may want to display drafts here or stuff as
|
This is because we may want to display drafts here or stuff as
|
||||||
|
@ -282,13 +282,13 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Helper function to get the associated mailbox object.
|
* Helper function to get the associated mailbox object.
|
||||||
*
|
*
|
||||||
* @memberof mrchatlist_t
|
* @memberof dc_chatlist_t
|
||||||
*
|
*
|
||||||
* @param chatlist The chatlist object to empty.
|
* @param chatlist The chatlist object to empty.
|
||||||
*
|
*
|
||||||
* @return Mailbox object associated with the chatlist. NULL if none or on errors.
|
* @return Mailbox object associated with the chatlist. NULL if none or on errors.
|
||||||
*/
|
*/
|
||||||
mrmailbox_t* mrchatlist_get_mailbox(mrchatlist_t* chatlist)
|
dc_context_t* dc_chatlist_get_context(dc_chatlist_t* chatlist)
|
||||||
{
|
{
|
||||||
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
if( chatlist == NULL || chatlist->m_magic != MR_CHATLIST_MAGIC ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -302,9 +302,9 @@ mrmailbox_t* mrchatlist_get_mailbox(mrchatlist_t* chatlist)
|
||||||
*
|
*
|
||||||
* Calling this function is not thread-safe, locking is up to the caller.
|
* Calling this function is not thread-safe, locking is up to the caller.
|
||||||
*
|
*
|
||||||
* @private @memberof mrchatlist_t
|
* @private @memberof dc_chatlist_t
|
||||||
*/
|
*/
|
||||||
int mrchatlist_load_from_db__(mrchatlist_t* ths, int listflags, const char* query__, uint32_t query_contact_id)
|
int mrchatlist_load_from_db__(dc_chatlist_t* ths, int listflags, const char* query__, uint32_t query_contact_id)
|
||||||
{
|
{
|
||||||
//clock_t start = clock();
|
//clock_t start = clock();
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,17 @@
|
||||||
/**
|
/**
|
||||||
* Create a new contact object in memory.
|
* Create a new contact object in memory.
|
||||||
* Typically the user does not call this function directly but gets contact
|
* Typically the user does not call this function directly but gets contact
|
||||||
* objects using mrmailbox_get_contact().
|
* objects using dc_get_contact().
|
||||||
*
|
*
|
||||||
* @private @memberof mrcontact_t
|
* @private @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @return The contact object. Must be freed using mrcontact_unref() when done.
|
* @return The contact object. Must be freed using dc_contact_unref() when done.
|
||||||
*/
|
*/
|
||||||
mrcontact_t* mrcontact_new(mrmailbox_t* mailbox)
|
dc_contact_t* dc_contact_new(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
mrcontact_t* ths = NULL;
|
dc_contact_t* ths = NULL;
|
||||||
|
|
||||||
if( (ths=calloc(1, sizeof(mrcontact_t)))==NULL ) {
|
if( (ths=calloc(1, sizeof(dc_contact_t)))==NULL ) {
|
||||||
exit(19); /* cannot allocate little memory, unrecoverable error */
|
exit(19); /* cannot allocate little memory, unrecoverable error */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,13 +54,13 @@ mrcontact_t* mrcontact_new(mrmailbox_t* mailbox)
|
||||||
/**
|
/**
|
||||||
* Free a contact object.
|
* Free a contact object.
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object as created eg. by mrmailbox_get_contact().
|
* @param contact The contact object as created eg. by dc_get_contact().
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrcontact_unref(mrcontact_t* contact)
|
void dc_contact_unref(dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact==NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact==NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -75,15 +75,15 @@ void mrcontact_unref(mrcontact_t* contact)
|
||||||
/**
|
/**
|
||||||
* Empty a contact object.
|
* Empty a contact object.
|
||||||
* Typically not needed by the user of the library. To free a contact object,
|
* Typically not needed by the user of the library. To free a contact object,
|
||||||
* use mrcontact_unref().
|
* use dc_contact_unref().
|
||||||
*
|
*
|
||||||
* @private @memberof mrcontact_t
|
* @private @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object to free.
|
* @param contact The contact object to free.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void mrcontact_empty(mrcontact_t* contact)
|
void dc_contact_empty(dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -113,13 +113,13 @@ void mrcontact_empty(mrcontact_t* contact)
|
||||||
/**
|
/**
|
||||||
* Get the ID of the contact.
|
* Get the ID of the contact.
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return the ID of the contact, 0 on errors.
|
* @return the ID of the contact, 0 on errors.
|
||||||
*/
|
*/
|
||||||
uint32_t mrcontact_get_id(const mrcontact_t* contact)
|
uint32_t dc_contact_get_id(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -131,13 +131,13 @@ uint32_t mrcontact_get_id(const mrcontact_t* contact)
|
||||||
/**
|
/**
|
||||||
* Get email address. The email address is always set for a contact.
|
* Get email address. The email address is always set for a contact.
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return String with the email address, must be free()'d. Never returns NULL.
|
* @return String with the email address, must be free()'d. Never returns NULL.
|
||||||
*/
|
*/
|
||||||
char* mrcontact_get_addr(const mrcontact_t* contact)
|
char* dc_contact_get_addr(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return safe_strdup(NULL);
|
return safe_strdup(NULL);
|
||||||
|
@ -153,15 +153,15 @@ char* mrcontact_get_addr(const mrcontact_t* contact)
|
||||||
*
|
*
|
||||||
* This name is typically used in a form where the user can edit the name of a contact.
|
* This name is typically used in a form where the user can edit the name of a contact.
|
||||||
* This name must not be spreaded via mail (To:, CC: ...) as it as it may be sth. like "Daddy".
|
* This name must not be spreaded via mail (To:, CC: ...) as it as it may be sth. like "Daddy".
|
||||||
* To get a fine name to display in lists etc., use mrcontact_get_display_name() or mrcontact_get_name_n_addr().
|
* To get a fine name to display in lists etc., use dc_contact_get_display_name() or dc_contact_get_name_n_addr().
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return String with the name to display, must be free()'d. Empty string if unset, never returns NULL.
|
* @return String with the name to display, must be free()'d. Empty string if unset, never returns NULL.
|
||||||
*/
|
*/
|
||||||
char* mrcontact_get_name(const mrcontact_t* contact)
|
char* dc_contact_get_name(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return safe_strdup(NULL);
|
return safe_strdup(NULL);
|
||||||
|
@ -176,15 +176,15 @@ char* mrcontact_get_name(const mrcontact_t* contact)
|
||||||
* modified by the user or, if both are unset, the email address.
|
* modified by the user or, if both are unset, the email address.
|
||||||
*
|
*
|
||||||
* This name is typically used in lists and must not be speaded via mail (To:, CC: ...).
|
* This name is typically used in lists and must not be speaded via mail (To:, CC: ...).
|
||||||
* To get the name editable in a formular, use mrcontact_get_name().
|
* To get the name editable in a formular, use dc_contact_get_name().
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return String with the name to display, must be free()'d. Never returns NULL.
|
* @return String with the name to display, must be free()'d. Never returns NULL.
|
||||||
*/
|
*/
|
||||||
char* mrcontact_get_display_name(const mrcontact_t* contact)
|
char* dc_contact_get_display_name(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return safe_strdup(NULL);
|
return safe_strdup(NULL);
|
||||||
|
@ -209,13 +209,13 @@ char* mrcontact_get_display_name(const mrcontact_t* contact)
|
||||||
*
|
*
|
||||||
* The summary must not be spreaded via mail (To:, CC: ...) as it as it may contain sth. like "Daddy".
|
* The summary must not be spreaded via mail (To:, CC: ...) as it as it may contain sth. like "Daddy".
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return Summary string, must be free()'d. Never returns NULL.
|
* @return Summary string, must be free()'d. Never returns NULL.
|
||||||
*/
|
*/
|
||||||
char* mrcontact_get_name_n_addr(const mrcontact_t* contact)
|
char* dc_contact_get_name_n_addr(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return safe_strdup(NULL);
|
return safe_strdup(NULL);
|
||||||
|
@ -234,13 +234,13 @@ char* mrcontact_get_name_n_addr(const mrcontact_t* contact)
|
||||||
* the prename. If there is no space, the full display name is returned.
|
* the prename. If there is no space, the full display name is returned.
|
||||||
* If the display name is not set, the e-mail address is returned.
|
* If the display name is not set, the e-mail address is returned.
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return String with the name to display, must be free()'d. Never returns NULL.
|
* @return String with the name to display, must be free()'d. Never returns NULL.
|
||||||
*/
|
*/
|
||||||
char* mrcontact_get_first_name(const mrcontact_t* contact)
|
char* dc_contact_get_first_name(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return safe_strdup(NULL);
|
return safe_strdup(NULL);
|
||||||
|
@ -257,15 +257,15 @@ char* mrcontact_get_first_name(const mrcontact_t* contact)
|
||||||
/**
|
/**
|
||||||
* Check if a contact is blocked.
|
* Check if a contact is blocked.
|
||||||
*
|
*
|
||||||
* To block or unblock a contact, use mrmailbox_block_contact().
|
* To block or unblock a contact, use dc_block_contact().
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return 1=contact is blocked, 0=contact is not blocked.
|
* @return 1=contact is blocked, 0=contact is not blocked.
|
||||||
*/
|
*/
|
||||||
int mrcontact_is_blocked(const mrcontact_t* contact)
|
int dc_contact_is_blocked(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
if( contact == NULL || contact->m_magic != MR_CONTACT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -274,7 +274,7 @@ int mrcontact_is_blocked(const mrcontact_t* contact)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mrcontact_is_verified__(const mrcontact_t* contact, const mrapeerstate_t* peerstate)
|
int mrcontact_is_verified__(const dc_contact_t* contact, const mrapeerstate_t* peerstate)
|
||||||
{
|
{
|
||||||
int contact_verified = MRV_NOT_VERIFIED;
|
int contact_verified = MRV_NOT_VERIFIED;
|
||||||
|
|
||||||
|
@ -300,14 +300,14 @@ cleanup:
|
||||||
*
|
*
|
||||||
* The UI may draw a checkbox or sth. like that beside verified contacts.
|
* The UI may draw a checkbox or sth. like that beside verified contacts.
|
||||||
*
|
*
|
||||||
* @memberof mrcontact_t
|
* @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param contact The contact object.
|
* @param contact The contact object.
|
||||||
*
|
*
|
||||||
* @return MRV_NOT_VERIFIED (0): contact is not verified.
|
* @return 0: contact is not verified.
|
||||||
* MRV_BIDIRECTIONAL (2): SELF and contact have verified their fingerprints in both directions; in the UI typically checkmarks are shown.
|
* 2: SELF and contact have verified their fingerprints in both directions; in the UI typically checkmarks are shown.
|
||||||
*/
|
*/
|
||||||
int mrcontact_is_verified(const mrcontact_t* contact)
|
int dc_contact_is_verified(const dc_contact_t* contact)
|
||||||
{
|
{
|
||||||
int contact_verified = MRV_NOT_VERIFIED;
|
int contact_verified = MRV_NOT_VERIFIED;
|
||||||
int locked = 0;
|
int locked = 0;
|
||||||
|
@ -341,7 +341,7 @@ cleanup:
|
||||||
* In a string, get the part before the first space.
|
* In a string, get the part before the first space.
|
||||||
* If there is no space in the string, the whole string is returned.
|
* If there is no space in the string, the whole string is returned.
|
||||||
*
|
*
|
||||||
* @private @memberof mrcontact_t
|
* @private @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param full_name Full name of the contact.
|
* @param full_name Full name of the contact.
|
||||||
*
|
*
|
||||||
|
@ -378,7 +378,7 @@ char* mr_get_first_name(const char* full_name)
|
||||||
*
|
*
|
||||||
* Typically, this function is not needed as it is called implicitly by mrmailbox_add_address_book()
|
* Typically, this function is not needed as it is called implicitly by mrmailbox_add_address_book()
|
||||||
*
|
*
|
||||||
* @private @memberof mrcontact_t
|
* @private @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param full_name Buffer with the name, is modified during processing; the
|
* @param full_name Buffer with the name, is modified during processing; the
|
||||||
* resulting string may be shorter but never longer.
|
* resulting string may be shorter but never longer.
|
||||||
|
@ -431,7 +431,7 @@ void mr_normalize_name(char* full_name)
|
||||||
* Not sure if we should also unifiy international characters before the @,
|
* Not sure if we should also unifiy international characters before the @,
|
||||||
* see also https://autocrypt.readthedocs.io/en/latest/address-canonicalization.html
|
* see also https://autocrypt.readthedocs.io/en/latest/address-canonicalization.html
|
||||||
*
|
*
|
||||||
* @private @memberof mrcontact_t
|
* @private @memberof dc_contact_t
|
||||||
*
|
*
|
||||||
* @param email_addr__ The email address to normalize.
|
* @param email_addr__ The email address to normalize.
|
||||||
*
|
*
|
||||||
|
@ -456,9 +456,9 @@ char* mr_normalize_addr(const char* email_addr__)
|
||||||
*
|
*
|
||||||
* Calling this function is not thread-safe, locking is up to the caller.
|
* Calling this function is not thread-safe, locking is up to the caller.
|
||||||
*
|
*
|
||||||
* @private @memberof mrcontact_t
|
* @private @memberof dc_contact_t
|
||||||
*/
|
*/
|
||||||
int mrcontact_load_from_db__(mrcontact_t* ths, mrsqlite3_t* sql, uint32_t contact_id)
|
int mrcontact_load_from_db__(dc_contact_t* ths, mrsqlite3_t* sql, uint32_t contact_id)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
sqlite3_stmt* stmt;
|
sqlite3_stmt* stmt;
|
||||||
|
|
18
src/mrjob.c
18
src/mrjob.c
|
@ -669,11 +669,11 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Execute pending jobs.
|
* Execute pending jobs.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void dc_perform_imap_jobs(mrmailbox_t* mailbox)
|
void dc_perform_imap_jobs(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
mrmailbox_log_info(mailbox, 0, "IMAP-jobs started...");
|
mrmailbox_log_info(mailbox, 0, "IMAP-jobs started...");
|
||||||
|
|
||||||
|
@ -690,11 +690,11 @@ void dc_perform_imap_jobs(mrmailbox_t* mailbox)
|
||||||
/**
|
/**
|
||||||
* Poll for new messages.
|
* Poll for new messages.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void dc_perform_imap_fetch(mrmailbox_t* mailbox)
|
void dc_perform_imap_fetch(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
|
|
||||||
|
@ -720,11 +720,11 @@ void dc_perform_imap_fetch(mrmailbox_t* mailbox)
|
||||||
/**
|
/**
|
||||||
* Wait for messages.
|
* Wait for messages.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
* @return None.
|
* @return None.
|
||||||
*/
|
*/
|
||||||
void dc_perform_imap_idle(mrmailbox_t* mailbox)
|
void dc_perform_imap_idle(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
connect_to_imap(mailbox, NULL); // also idle if connection fails because of not-configured, no-network, whatever. mrimap_idle() will handle this by the fake-idle and log a warning
|
connect_to_imap(mailbox, NULL); // also idle if connection fails because of not-configured, no-network, whatever. mrimap_idle() will handle this by the fake-idle and log a warning
|
||||||
|
|
||||||
|
@ -745,13 +745,13 @@ void dc_perform_imap_idle(mrmailbox_t* mailbox)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interrupt the mrmailbox_perform_imap_idle().
|
* Interrupt dc_perform_imap_idle().
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void dc_interrupt_imap_idle(mrmailbox_t* mailbox)
|
void dc_interrupt_imap_idle(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
if( mailbox == NULL || mailbox->m_magic != MR_MAILBOX_MAGIC || mailbox->m_imap == NULL ) {
|
if( mailbox == NULL || mailbox->m_magic != MR_MAILBOX_MAGIC || mailbox->m_imap == NULL ) {
|
||||||
mrmailbox_log_warning(mailbox, 0, "Interrupt IMAP-IDLE: Bad parameters.");
|
mrmailbox_log_warning(mailbox, 0, "Interrupt IMAP-IDLE: Bad parameters.");
|
||||||
|
|
36
src/mrlot.c
36
src/mrlot.c
|
@ -43,16 +43,16 @@ mrlot_t* mrlot_new()
|
||||||
/**
|
/**
|
||||||
* Frees an object containing a set of parameters.
|
* Frees an object containing a set of parameters.
|
||||||
* If the set object contains strings, the strings are also freed with this function.
|
* If the set object contains strings, the strings are also freed with this function.
|
||||||
* Set objects are created eg. by mrchatlist_get_summary(), mrmsg_get_summary or by
|
* Set objects are created eg. by dc_chatlist_get_summary(), dc_msg_get_summary or by
|
||||||
* mrmsg_get_mediainfo().
|
* dc_msg_get_mediainfo().
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param set The object to free.
|
* @param set The object to free.
|
||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void mrlot_unref(mrlot_t* set)
|
void dc_lot_unref(dc_lot_t* set)
|
||||||
{
|
{
|
||||||
if( set==NULL || set->m_magic != MR_LOT_MAGIC ) {
|
if( set==NULL || set->m_magic != MR_LOT_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -93,15 +93,15 @@ void mrlot_empty(mrlot_t* ths)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get first string. The meaning of the string is defined by the creator of the object and may be roughly described by mrlot_get_text1_meaning().
|
* Get first string. The meaning of the string is defined by the creator of the object and may be roughly described by dc_lot_get_text1_meaning().
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param lot The lot object.
|
* @param lot The lot object.
|
||||||
*
|
*
|
||||||
* @return A string, the string may be empty and the returned value must be free()'d. NULL if there is no such string.
|
* @return A string, the string may be empty and the returned value must be free()'d. NULL if there is no such string.
|
||||||
*/
|
*/
|
||||||
char* mrlot_get_text1(mrlot_t* lot)
|
char* dc_lot_get_text1(dc_lot_t* lot)
|
||||||
{
|
{
|
||||||
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -113,13 +113,13 @@ char* mrlot_get_text1(mrlot_t* lot)
|
||||||
/**
|
/**
|
||||||
* Get second string. The meaning of the string is defined by the creator of the object.
|
* Get second string. The meaning of the string is defined by the creator of the object.
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param lot The lot object.
|
* @param lot The lot object.
|
||||||
*
|
*
|
||||||
* @return A string, the string may be empty and the returned value must be free()'d . NULL if there is no such string.
|
* @return A string, the string may be empty and the returned value must be free()'d . NULL if there is no such string.
|
||||||
*/
|
*/
|
||||||
char* mrlot_get_text2(mrlot_t* lot)
|
char* dc_lot_get_text2(dc_lot_t* lot)
|
||||||
{
|
{
|
||||||
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -130,16 +130,16 @@ char* mrlot_get_text2(mrlot_t* lot)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the meaning of the first string. Posssible meanings of the string are defined by the creator of the object and may be returned eg.
|
* Get the meaning of the first string. Posssible meanings of the string are defined by the creator of the object and may be returned eg.
|
||||||
* as MR_TEXT1_DRAFT, MR_TEXT1_USERNAME or MR_TEXT1_SELF.
|
* as DC_TEXT1_DRAFT, DC_TEXT1_USERNAME or DC_TEXT1_SELF.
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param lot The lot object.
|
* @param lot The lot object.
|
||||||
*
|
*
|
||||||
* @return Returns the meaning of the first string, possible meanings are defined by the creator of the object.
|
* @return Returns the meaning of the first string, possible meanings are defined by the creator of the object.
|
||||||
* 0 if there is no concrete meaning or on errors.
|
* 0 if there is no concrete meaning or on errors.
|
||||||
*/
|
*/
|
||||||
int mrlot_get_text1_meaning(mrlot_t* lot)
|
int dc_lot_get_text1_meaning(dc_lot_t* lot)
|
||||||
{
|
{
|
||||||
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -151,13 +151,13 @@ int mrlot_get_text1_meaning(mrlot_t* lot)
|
||||||
/**
|
/**
|
||||||
* Get the associated state. The meaning of the state is defined by the creator of the object.
|
* Get the associated state. The meaning of the state is defined by the creator of the object.
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param lot The lot object.
|
* @param lot The lot object.
|
||||||
*
|
*
|
||||||
* @return The state as defined by the creator of the object. 0 if there is not state or on errors.
|
* @return The state as defined by the creator of the object. 0 if there is not state or on errors.
|
||||||
*/
|
*/
|
||||||
int mrlot_get_state(mrlot_t* lot)
|
int dc_lot_get_state(dc_lot_t* lot)
|
||||||
{
|
{
|
||||||
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -169,13 +169,13 @@ int mrlot_get_state(mrlot_t* lot)
|
||||||
/**
|
/**
|
||||||
* Get the associated ID. The meaning of the ID is defined by the creator of the object.
|
* Get the associated ID. The meaning of the ID is defined by the creator of the object.
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param lot The lot object.
|
* @param lot The lot object.
|
||||||
*
|
*
|
||||||
* @return The state as defined by the creator of the object. 0 if there is not state or on errors.
|
* @return The state as defined by the creator of the object. 0 if there is not state or on errors.
|
||||||
*/
|
*/
|
||||||
uint32_t mrlot_get_id(mrlot_t* lot)
|
uint32_t dc_lot_get_id(dc_lot_t* lot)
|
||||||
{
|
{
|
||||||
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -187,13 +187,13 @@ uint32_t mrlot_get_id(mrlot_t* lot)
|
||||||
/**
|
/**
|
||||||
* Get the associated timestamp. The meaning of the timestamp is defined by the creator of the object.
|
* Get the associated timestamp. The meaning of the timestamp is defined by the creator of the object.
|
||||||
*
|
*
|
||||||
* @memberof mrlot_t
|
* @memberof dc_lot_t
|
||||||
*
|
*
|
||||||
* @param lot The lot object.
|
* @param lot The lot object.
|
||||||
*
|
*
|
||||||
* @return The timestamp as defined by the creator of the object. 0 if there is not timestamp or on errors.
|
* @return The timestamp as defined by the creator of the object. 0 if there is not timestamp or on errors.
|
||||||
*/
|
*/
|
||||||
time_t mrlot_get_timestamp(mrlot_t* lot)
|
time_t dc_lot_get_timestamp(dc_lot_t* lot)
|
||||||
{
|
{
|
||||||
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
if( lot == NULL || lot->m_magic != MR_LOT_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
540
src/mrmailbox.c
540
src/mrmailbox.c
File diff suppressed because it is too large
Load diff
|
@ -135,7 +135,7 @@ extern "C" {
|
||||||
#define mrchatlist_get_chat_id dc_chatlist_get_chat_id
|
#define mrchatlist_get_chat_id dc_chatlist_get_chat_id
|
||||||
#define mrchatlist_get_msg_id dc_chatlist_get_msg_id
|
#define mrchatlist_get_msg_id dc_chatlist_get_msg_id
|
||||||
#define mrchatlist_get_summary dc_chatlist_get_summary
|
#define mrchatlist_get_summary dc_chatlist_get_summary
|
||||||
#define mrchatlist_get_mailbox dc_chatlist_get_mailbox
|
#define mrchatlist_get_mailbox dc_chatlist_get_context
|
||||||
|
|
||||||
// chat functions
|
// chat functions
|
||||||
#define MR_CHAT_ID_DEADDROP DC_CHAT_ID_DEADDROP
|
#define MR_CHAT_ID_DEADDROP DC_CHAT_ID_DEADDROP
|
||||||
|
|
|
@ -691,39 +691,34 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Configure and connect a mailbox.
|
* Configure and connect a mailbox.
|
||||||
* For this, the function creates a job that is executed in the IMAP-thread then;
|
* For this, the function creates a job that is executed in the IMAP-thread then;
|
||||||
* this requires to call mrmailbox_perform_jobs() regulary.
|
* this requires to call dc_perform_imap_jobs() regulary.
|
||||||
*
|
*
|
||||||
* - Before your call this function, you should set at least `addr` and `mail_pw`
|
* - Before your call this function, you should set at least `addr` and `mail_pw`
|
||||||
* using mrmailbox_set_config().
|
* using dc_set_config().
|
||||||
*
|
*
|
||||||
* - mrmailbox_configure() may take a while,
|
* - While dc_configure() returns immediately, the started configuration-job may take a while,
|
||||||
* you can use mrmailbox_stop_ongoing_process().
|
* you can stop it using dc_stop_ongoing_process().
|
||||||
*
|
*
|
||||||
* - The function sends out a number of #MR_EVENT_CONFIGURE_PROGRESS events that may be used to create
|
* - The function sends out a number of #MR_EVENT_CONFIGURE_PROGRESS events that may be used to create
|
||||||
* a progress bar or stuff like that.
|
* a progress bar or stuff like that.
|
||||||
*
|
*
|
||||||
* - ongoing idle processed will be killed and calling mrimap_idle() while this function
|
* @memberof dc_context_t
|
||||||
* has not terminated will fail; if needed, call mrimap_idle() when this function succeeds.
|
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @param mailbox the mailbox object as created by dc_context_new().
|
||||||
*
|
|
||||||
* @param mailbox the mailbox object as created by mrmailbox_new().
|
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return None.
|
||||||
*
|
*
|
||||||
* There is no need to call this every program start, the result is saved in the
|
* There is no need to call this every program start, the result is saved in the
|
||||||
* database and you can call mrmailbox_poll() or mrmailbox_idle() directly:
|
* database and you can call use the connection directly:
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* if( !mrmailbox_is_configured(mailbox) ) {
|
* if( !dc_is_configured(context) ) {
|
||||||
* if( !mrmailbox_configure(mailbox) ) {
|
* dc_configure(context);
|
||||||
* // show an error and/or try over
|
* // wait for progress events
|
||||||
* }
|
|
||||||
* }
|
* }
|
||||||
* mrmailbox_idle(mailbox);
|
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
void mrmailbox_configure(mrmailbox_t* mailbox)
|
void dc_configure(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
mrjob_kill_actions(mailbox, MRJ_CONFIGURE_IMAP, 0);
|
mrjob_kill_actions(mailbox, MRJ_CONFIGURE_IMAP, 0);
|
||||||
mrjob_add(mailbox, MRJ_CONFIGURE_IMAP, 0, NULL, 0); // results in a call to mrmailbox_configure_job()
|
mrjob_add(mailbox, MRJ_CONFIGURE_IMAP, 0, NULL, 0); // results in a call to mrmailbox_configure_job()
|
||||||
|
@ -734,16 +729,16 @@ void mrmailbox_configure(mrmailbox_t* mailbox)
|
||||||
* Check if the mailbox is already configured.
|
* Check if the mailbox is already configured.
|
||||||
*
|
*
|
||||||
* Typically, for unconfigured mailboxes, the user is prompeted for
|
* Typically, for unconfigured mailboxes, the user is prompeted for
|
||||||
* to enter some settings and mrmailbox_configure() is called in a thread then.
|
* to enter some settings and dc_configure() is called in a thread then.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object as created by mrmailbox_new().
|
* @param mailbox The mailbox object as created by dc_context_new().
|
||||||
*
|
*
|
||||||
* @return 1=mailbox is configured and mrmailbox_poll() or mrmailbox_idle() will work as expected;
|
* @return 1=context is configuredc can be used;
|
||||||
* 0=mailbox is not configured and a configuration by mrmailbox_configure() is required.
|
* 0=context is not configured and a configuration by dc_configure() is required.
|
||||||
*/
|
*/
|
||||||
int mrmailbox_is_configured(mrmailbox_t* mailbox)
|
int dc_is_configured(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
int is_configured;
|
int is_configured;
|
||||||
|
|
||||||
|
@ -806,28 +801,28 @@ void mrmailbox_free_ongoing(mrmailbox_t* mailbox)
|
||||||
/**
|
/**
|
||||||
* Signal an ongoing process to stop.
|
* Signal an ongoing process to stop.
|
||||||
*
|
*
|
||||||
* After that, mrmailbox_stop_ongoing_process() returns _without_ waiting
|
* After that, dc_stop_ongoing_process() returns _without_ waiting
|
||||||
* for the ongoing process to return.
|
* for the ongoing process to return.
|
||||||
*
|
*
|
||||||
* The ongoing process will return ASAP then, however, it may
|
* The ongoing process will return ASAP then, however, it may
|
||||||
* still take a moment. If in doubt, the caller may also decide to kill the
|
* still take a moment. If in doubt, the caller may also decide to kill the
|
||||||
* thread after a few seconds; eg. the process may hang in a
|
* thread after a few seconds; eg. the process may hang in a
|
||||||
* function not under the control of the core (eg. #MR_EVENT_HTTP_GET). Another
|
* function not under the control of the core (eg. #MR_EVENT_HTTP_GET). Another
|
||||||
* reason for mrmailbox_stop_ongoing_process() not to wait is that otherwise it
|
* reason for dc_stop_ongoing_process() not to wait is that otherwise it
|
||||||
* would be GUI-blocking and should be started in another thread then; this
|
* would be GUI-blocking and should be started in another thread then; this
|
||||||
* would make things even more complicated.
|
* would make things even more complicated.
|
||||||
*
|
*
|
||||||
* Typical ongoing processes are started by mrmailbox_configure(),
|
* Typical ongoing processes are started by dc_configure(),
|
||||||
* mrmailbox_initiate_key_transfer() or mrmailbox_imex(). As there is always at most only
|
* dc_initiate_key_transfer() or dc_imex(). As there is always at most only
|
||||||
* one onging process at the same time, there is no need to define _which_ process to exit.
|
* one onging process at the same time, there is no need to define _which_ process to exit.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void mrmailbox_stop_ongoing_process(mrmailbox_t* mailbox)
|
void dc_stop_ongoing_process(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
if( mailbox == NULL || mailbox->m_magic != MR_MAILBOX_MAGIC ) {
|
if( mailbox == NULL || mailbox->m_magic != MR_MAILBOX_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
* mrmailbox_render_setup_file() renders the body after the second
|
* mrmailbox_render_setup_file() renders the body after the second
|
||||||
* `-==break1==` in this example.
|
* `-==break1==` in this example.
|
||||||
*
|
*
|
||||||
* @private @memberof mrmailbox_t
|
* @private @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object
|
* @param mailbox The mailbox object
|
||||||
* @param passphrase The setup code that shall be used to encrypt the message.
|
* @param passphrase The setup code that shall be used to encrypt the message.
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
* @return String with the HTML-code of the message on success, NULL on errors.
|
* @return String with the HTML-code of the message on success, NULL on errors.
|
||||||
* The returned value must be free()'d
|
* The returned value must be free()'d
|
||||||
*/
|
*/
|
||||||
char* mrmailbox_render_setup_file(mrmailbox_t* mailbox, const char* passphrase)
|
char* mrmailbox_render_setup_file(dc_context_t* mailbox, const char* passphrase)
|
||||||
{
|
{
|
||||||
int locked = 0;
|
int locked = 0;
|
||||||
sqlite3_stmt* stmt = NULL;
|
sqlite3_stmt* stmt = NULL;
|
||||||
|
@ -298,7 +298,7 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Parse the given file content and extract the private key.
|
* Parse the given file content and extract the private key.
|
||||||
*
|
*
|
||||||
* @private @memberof mrmailbox_t
|
* @private @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object
|
* @param mailbox The mailbox object
|
||||||
* @param passphrase The setup code that shall be used to decrypt the message.
|
* @param passphrase The setup code that shall be used to decrypt the message.
|
||||||
|
@ -310,7 +310,7 @@ cleanup:
|
||||||
* @return The decrypted private key as armored-ascii-data or NULL on errors.
|
* @return The decrypted private key as armored-ascii-data or NULL on errors.
|
||||||
* Must be mrkey_unref()'d.
|
* Must be mrkey_unref()'d.
|
||||||
*/
|
*/
|
||||||
char* mrmailbox_decrypt_setup_file(mrmailbox_t* mailbox, const char* passphrase, const char* filecontent)
|
char* mrmailbox_decrypt_setup_file(dc_context_t* mailbox, const char* passphrase, const char* filecontent)
|
||||||
{
|
{
|
||||||
char* fc_buf = NULL;
|
char* fc_buf = NULL;
|
||||||
const char *fc_headerline = NULL, *fc_base64 = NULL;
|
const char *fc_headerline = NULL, *fc_base64 = NULL;
|
||||||
|
@ -360,13 +360,13 @@ cleanup:
|
||||||
*
|
*
|
||||||
* A higher-level function to initiate the key transfer is mrmailbox_initiate_key_transfer().
|
* A higher-level function to initiate the key transfer is mrmailbox_initiate_key_transfer().
|
||||||
*
|
*
|
||||||
* @private @memberof mrmailbox_t
|
* @private @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox Mailbox object as created by mrmailbox_new().
|
* @param mailbox Mailbox object as created by mrmailbox_new().
|
||||||
*
|
*
|
||||||
* @return Setup code, must be free()'d after usage. NULL on errors.
|
* @return Setup code, must be free()'d after usage. NULL on errors.
|
||||||
*/
|
*/
|
||||||
char* mrmailbox_create_setup_code(mrmailbox_t* mailbox)
|
char* mrmailbox_create_setup_code(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
#define CODE_ELEMS 9
|
#define CODE_ELEMS 9
|
||||||
uint16_t random_val;
|
uint16_t random_val;
|
||||||
|
@ -425,7 +425,7 @@ char* mrmailbox_normalize_setup_code(mrmailbox_t* mailbox, const char* in)
|
||||||
/**
|
/**
|
||||||
* Initiate Autocrypt Key Transfer.
|
* Initiate Autocrypt Key Transfer.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
*
|
*
|
||||||
|
@ -442,7 +442,7 @@ char* mrmailbox_normalize_setup_code(mrmailbox_t* mailbox, const char* in)
|
||||||
* After that, this function should be called to send the Autocrypt setup message.
|
* After that, this function should be called to send the Autocrypt setup message.
|
||||||
* The function creates the setup message and waits until it is really sent.
|
* The function creates the setup message and waits until it is really sent.
|
||||||
* As this may take a while, it is recommended to start the function in a separate thread;
|
* As this may take a while, it is recommended to start the function in a separate thread;
|
||||||
* to interrupt it, you can use mrmailbox_stop_ongoing_process().
|
* to interrupt it, you can use dc_stop_ongoing_process().
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* After everything succeeded, the required setup code is returned in the following format:
|
* After everything succeeded, the required setup code is returned in the following format:
|
||||||
|
@ -465,13 +465,13 @@ char* mrmailbox_normalize_setup_code(mrmailbox_t* mailbox, const char* in)
|
||||||
* Once you're done, your other device will be ready to use Autocrypt."
|
* Once you're done, your other device will be ready to use Autocrypt."
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* On the _other device_ you will call mrmailbox_continue_key_transfer() then
|
* On the _other device_ you will call dc_continue_key_transfer() then
|
||||||
* for setup messages identified by mrmsg_is_setupmessage().
|
* for setup messages identified by dc_msg_is_setupmessage().
|
||||||
*
|
*
|
||||||
* For more details about the Autocrypt setup process, please refer to
|
* For more details about the Autocrypt setup process, please refer to
|
||||||
* https://autocrypt.org/en/latest/level1.html#autocrypt-setup-message
|
* https://autocrypt.org/en/latest/level1.html#autocrypt-setup-message
|
||||||
*/
|
*/
|
||||||
char* mrmailbox_initiate_key_transfer(mrmailbox_t* mailbox)
|
char* dc_initiate_key_transfer(dc_context_t* mailbox)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
char* setup_code = NULL;
|
char* setup_code = NULL;
|
||||||
|
@ -629,26 +629,26 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Continue the Autocrypt Key Transfer on another device.
|
* Continue the Autocrypt Key Transfer on another device.
|
||||||
*
|
*
|
||||||
* If you have started the key transfer on another device using mrmailbox_initiate_key_transfer()
|
* If you have started the key transfer on another device using dc_initiate_key_transfer()
|
||||||
* and you've detected a setup message with mrmsg_is_setupmessage(), you should prompt the
|
* and you've detected a setup message with dc_msg_is_setupmessage(), you should prompt the
|
||||||
* user for the setup code and call this function then.
|
* user for the setup code and call this function then.
|
||||||
*
|
*
|
||||||
* You can use mrmsg_get_setupcodebegin() to give the user a hint about the code (useful if the user
|
* You can use dc_msg_get_setupcodebegin() to give the user a hint about the code (useful if the user
|
||||||
* has created several messages and should not enter the wrong code).
|
* has created several messages and should not enter the wrong code).
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
* @param msg_id ID of the setup message to decrypt.
|
* @param msg_id ID of the setup message to decrypt.
|
||||||
* @param setup_code Setup code entered by the user. This is the same setup code as returned from
|
* @param setup_code Setup code entered by the user. This is the same setup code as returned from
|
||||||
* mrmailbox_initiate_key_transfer() on the other device.
|
* dc_initiate_key_transfer() on the other device.
|
||||||
* There is no need to format the string correctly, the function will remove all spaces and other characters and
|
* There is no need to format the string correctly, the function will remove all spaces and other characters and
|
||||||
* insert the `-` characters at the correct places.
|
* insert the `-` characters at the correct places.
|
||||||
*
|
*
|
||||||
* @return 1=key successfully decrypted and imported; both devices will use the same key now;
|
* @return 1=key successfully decrypted and imported; both devices will use the same key now;
|
||||||
* 0=key transfer failed eg. due to a bad setup code.
|
* 0=key transfer failed eg. due to a bad setup code.
|
||||||
*/
|
*/
|
||||||
int mrmailbox_continue_key_transfer(mrmailbox_t* mailbox, uint32_t msg_id, const char* setup_code)
|
int dc_continue_key_transfer(dc_context_t* mailbox, uint32_t msg_id, const char* setup_code)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
mrmsg_t* msg = NULL;
|
mrmsg_t* msg = NULL;
|
||||||
|
@ -1165,22 +1165,22 @@ cleanup:
|
||||||
*
|
*
|
||||||
* What to do is defined by the _what_ parameter which may be one of the following:
|
* What to do is defined by the _what_ parameter which may be one of the following:
|
||||||
*
|
*
|
||||||
* - **MR_IMEX_EXPORT_BACKUP** (11) - Export a backup to the directory given as `param1`.
|
* - **DC_IMEX_EXPORT_BACKUP** (11) - Export a backup to the directory given as `param1`.
|
||||||
* The backup contains all contacts, chats, images and other data and device independent settings.
|
* The backup contains all contacts, chats, images and other data and device independent settings.
|
||||||
* The backup does not contain device dependent settings as ringtones or LED notification settings.
|
* The backup does not contain device dependent settings as ringtones or LED notification settings.
|
||||||
* The name of the backup is typically `delta-chat.<day>.bak`, if more than one backup is create on a day,
|
* The name of the backup is typically `delta-chat.<day>.bak`, if more than one backup is create on a day,
|
||||||
* the format is `delta-chat.<day>-<number>.bak`
|
* the format is `delta-chat.<day>-<number>.bak`
|
||||||
*
|
*
|
||||||
* - **MR_IMEX_IMPORT_BACKUP** (12) - `param1` is the file (not: directory) to import. The file is normally
|
* - **DC_IMEX_IMPORT_BACKUP** (12) - `param1` is the file (not: directory) to import. The file is normally
|
||||||
* created by MR_IMEX_EXPORT_BACKUP and detected by mrmailbox_imex_has_backup(). Importing a backup
|
* created by DC_IMEX_EXPORT_BACKUP and detected by dc_imex_has_backup(). Importing a backup
|
||||||
* is only possible as long as the mailbox is not configured or used in another way.
|
* is only possible as long as the mailbox is not configured or used in another way.
|
||||||
*
|
*
|
||||||
* - **MR_IMEX_EXPORT_SELF_KEYS** (1) - Export all private keys and all public keys of the user to the
|
* - **DC_IMEX_EXPORT_SELF_KEYS** (1) - Export all private keys and all public keys of the user to the
|
||||||
* directory given as `param1`. The default key is written to the files `public-key-default.asc`
|
* directory given as `param1`. The default key is written to the files `public-key-default.asc`
|
||||||
* and `private-key-default.asc`, if there are more keys, they are written to files as
|
* and `private-key-default.asc`, if there are more keys, they are written to files as
|
||||||
* `public-key-<id>.asc` and `private-key-<id>.asc`
|
* `public-key-<id>.asc` and `private-key-<id>.asc`
|
||||||
*
|
*
|
||||||
* - **MR_IMEX_IMPORT_SELF_KEYS** (2) - Import private keys found in the directory given as `param1`.
|
* - **DC_IMEX_IMPORT_SELF_KEYS** (2) - Import private keys found in the directory given as `param1`.
|
||||||
* The last imported key is made the default keys unless its name contains the string `legacy`. Public keys are not imported.
|
* The last imported key is made the default keys unless its name contains the string `legacy`. Public keys are not imported.
|
||||||
*
|
*
|
||||||
* The function may take a long time until it finishes, so it might be a good idea to start it in a
|
* The function may take a long time until it finishes, so it might be a good idea to start it in a
|
||||||
|
@ -1192,19 +1192,19 @@ cleanup:
|
||||||
* - For each file written on export, the function sends #MR_EVENT_IMEX_FILE_WRITTEN
|
* - For each file written on export, the function sends #MR_EVENT_IMEX_FILE_WRITTEN
|
||||||
*
|
*
|
||||||
* Only one import-/export-progress can run at the same time.
|
* Only one import-/export-progress can run at the same time.
|
||||||
* To cancel an import-/export-progress, use mrmailbox_stop_ongoing_process().
|
* To cancel an import-/export-progress, use dc_stop_ongoing_process().
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox Mailbox object as created by mrmailbox_new().
|
* @param mailbox Mailbox object as created by dc_context_new().
|
||||||
* @param what One of the MR_IMEX_* constants.
|
* @param what One of the DC_IMEX_* constants.
|
||||||
* @param param1 Meaning depends on the MR_IMEX_* constants. If this parameter is a directory, it should not end with
|
* @param param1 Meaning depends on the DC_IMEX_* constants. If this parameter is a directory, it should not end with
|
||||||
* a slash (otherwise you'll get double slashes when receiving #MR_EVENT_IMEX_FILE_WRITTEN). Set to NULL if not used.
|
* a slash (otherwise you'll get double slashes when receiving #MR_EVENT_IMEX_FILE_WRITTEN). Set to NULL if not used.
|
||||||
* @param param2 Meaning depends on the MR_IMEX_* constants. Set to NULL if not used.
|
* @param param2 Meaning depends on the DC_IMEX_* constants. Set to NULL if not used.
|
||||||
*
|
*
|
||||||
* @return 1=success, 0=error or progress canceled.
|
* @return 1=success, 0=error or progress canceled.
|
||||||
*/
|
*/
|
||||||
int mrmailbox_imex(mrmailbox_t* mailbox, int what, const char* param1, const char* param2)
|
int dc_imex(dc_context_t* mailbox, int what, const char* param1, const char* param2)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
|
|
||||||
|
@ -1282,14 +1282,14 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Check if there is a backup file.
|
* Check if there is a backup file.
|
||||||
*
|
*
|
||||||
* May only be used on fresh installations (eg. mrmailbox_is_configured() returns 0).
|
* May only be used on fresh installations (eg. dc_is_configured() returns 0).
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox Mailbox object as created by mrmailbox_new().
|
* @param mailbox Mailbox object as created by dc_context_new().
|
||||||
* @param dir_name Directory to search backups in.
|
* @param dir_name Directory to search backups in.
|
||||||
*
|
*
|
||||||
* @return String with the backup file, typically given to mrmailbox_imex(), returned strings must be free()'d.
|
* @return String with the backup file, typically given to dc_imex(), returned strings must be free()'d.
|
||||||
* The function returns NULL if no backup was found.
|
* The function returns NULL if no backup was found.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
|
@ -1300,7 +1300,7 @@ cleanup:
|
||||||
* void ask_user_for_credentials()
|
* void ask_user_for_credentials()
|
||||||
* {
|
* {
|
||||||
* // - ask the user for email and password
|
* // - ask the user for email and password
|
||||||
* // - save them using mrmailbox_set_config()
|
* // - save them using dc_set_config()
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* int ask_user_whether_to_import()
|
* int ask_user_whether_to_import()
|
||||||
|
@ -1311,26 +1311,26 @@ cleanup:
|
||||||
* return 1;
|
* return 1;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* if( !mrmailbox_is_configured(mailbox) )
|
* if( !dc_is_configured(mailbox) )
|
||||||
* {
|
* {
|
||||||
* char* file = NULL;
|
* char* file = NULL;
|
||||||
* if( (file=mrmailbox_imex_has_backup(mailbox, dir))!=NULL && ask_user_whether_to_import() )
|
* if( (file=dc_imex_has_backup(mailbox, dir))!=NULL && ask_user_whether_to_import() )
|
||||||
* {
|
* {
|
||||||
* mrmailbox_imex(mailbox, MR_IMEX_IMPORT_BACKUP, file, NULL);
|
* dc_imex(mailbox, DC_IMEX_IMPORT_BACKUP, file, NULL);
|
||||||
* mrmailbox_connect(mailbox);
|
* // connect
|
||||||
* }
|
* }
|
||||||
* else
|
* else
|
||||||
* {
|
* {
|
||||||
* do {
|
* do {
|
||||||
* ask_user_for_credentials();
|
* ask_user_for_credentials();
|
||||||
* }
|
* }
|
||||||
* while( !mrmailbox_configure(mailbox) )
|
* while( !configure_succeeded() )
|
||||||
* }
|
* }
|
||||||
* free(file);
|
* free(file);
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
char* mrmailbox_imex_has_backup(mrmailbox_t* mailbox, const char* dir_name)
|
char* dc_imex_has_backup(dc_context_t* mailbox, const char* dir_name)
|
||||||
{
|
{
|
||||||
char* ret = NULL;
|
char* ret = NULL;
|
||||||
time_t ret_backup_time = 0;
|
time_t ret_backup_time = 0;
|
||||||
|
@ -1389,14 +1389,14 @@ cleanup:
|
||||||
* Check if the user is authorized by the given password in some way.
|
* Check if the user is authorized by the given password in some way.
|
||||||
* This is to promt for the password eg. before exporting keys/backup.
|
* This is to promt for the password eg. before exporting keys/backup.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox Mailbox object as created by mrmailbox_new().
|
* @param mailbox Mailbox object as created by dc_context_new().
|
||||||
* @param test_pw Password to check.
|
* @param test_pw Password to check.
|
||||||
*
|
*
|
||||||
* @return 1=user is authorized, 0=user is not authorized.
|
* @return 1=user is authorized, 0=user is not authorized.
|
||||||
*/
|
*/
|
||||||
int mrmailbox_check_password(mrmailbox_t* mailbox, const char* test_pw)
|
int dc_check_password(dc_context_t* mailbox, const char* test_pw)
|
||||||
{
|
{
|
||||||
/* Check if the given password matches the configured mail_pw.
|
/* Check if the given password matches the configured mail_pw.
|
||||||
This is to prompt the user before starting eg. an export; this is mainly to avoid doing people bad thinkgs if they have short access to the device.
|
This is to prompt the user before starting eg. an export; this is mainly to avoid doing people bad thinkgs if they have short access to the device.
|
||||||
|
|
|
@ -37,14 +37,14 @@
|
||||||
* The function should be called after a QR code is scanned.
|
* The function should be called after a QR code is scanned.
|
||||||
* The function takes the raw text scanned and checks what can be done with it.
|
* The function takes the raw text scanned and checks what can be done with it.
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
* @param qr The text of the scanned QR code.
|
* @param qr The text of the scanned QR code.
|
||||||
*
|
*
|
||||||
* @return Parsed QR code as an mrlot_t object.
|
* @return Parsed QR code as an dc_lot_t object.
|
||||||
*/
|
*/
|
||||||
mrlot_t* mrmailbox_check_qr(mrmailbox_t* mailbox, const char* qr)
|
dc_lot_t* dc_check_qr(dc_context_t* mailbox, const char* qr)
|
||||||
{
|
{
|
||||||
int locked = 0;
|
int locked = 0;
|
||||||
char* payload = NULL;
|
char* payload = NULL;
|
||||||
|
|
|
@ -337,11 +337,11 @@ static void end_bobs_joining(mrmailbox_t* mailbox, int status)
|
||||||
* fingerprint comparison also works eg. with K-9 or OpenKeychain.
|
* fingerprint comparison also works eg. with K-9 or OpenKeychain.
|
||||||
*
|
*
|
||||||
* The scanning Delta Chat device will pass the scanned content to
|
* The scanning Delta Chat device will pass the scanned content to
|
||||||
* mrmailbox_check_qr() then; if this function returns
|
* dc_check_qr() then; if this function returns
|
||||||
* MR_QR_ASK_VERIFYCONTACT or MR_QR_ASK_VERIFYGROUP an out-of-band-verification
|
* DC_QR_ASK_VERIFYCONTACT or DC_QR_ASK_VERIFYGROUP an out-of-band-verification
|
||||||
* can be joined using mrmailbox_join_securejoin()
|
* can be joined using dc_join_securejoin()
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object.
|
* @param mailbox The mailbox object.
|
||||||
*
|
*
|
||||||
|
@ -350,7 +350,7 @@ static void end_bobs_joining(mrmailbox_t* mailbox, int status)
|
||||||
*
|
*
|
||||||
* @return Text that should go to the qr code.
|
* @return Text that should go to the qr code.
|
||||||
*/
|
*/
|
||||||
char* mrmailbox_get_securejoin_qr(mrmailbox_t* mailbox, uint32_t group_chat_id)
|
char* dc_get_securejoin_qr(dc_context_t* mailbox, uint32_t group_chat_id)
|
||||||
{
|
{
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
==== Alice - the inviter side ====
|
==== Alice - the inviter side ====
|
||||||
|
@ -444,19 +444,19 @@ cleanup:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join an out-of-band-verification initiated on another device with mrmailbox_get_securejoin_qr().
|
* Join an out-of-band-verification initiated on another device with dc_get_securejoin_qr().
|
||||||
* This function is typically called when mrmailbox_check_qr() returns
|
* This function is typically called when dc_check_qr() returns
|
||||||
* lot.m_state=MR_QR_ASK_VERIFYCONTACT or lot.m_state=MR_QR_ASK_VERIFYGROUP.
|
* lot.m_state=DC_QR_ASK_VERIFYCONTACT or lot.m_state=DC_QR_ASK_VERIFYGROUP.
|
||||||
*
|
*
|
||||||
* This function takes some time and sends and receives several messages.
|
* This function takes some time and sends and receives several messages.
|
||||||
* You should call it in a separate thread; if you want to abort it, you should
|
* You should call it in a separate thread; if you want to abort it, you should
|
||||||
* call mrmailbox_stop_ongoing_process().
|
* call dc_stop_ongoing_process().
|
||||||
*
|
*
|
||||||
* @memberof mrmailbox_t
|
* @memberof dc_context_t
|
||||||
*
|
*
|
||||||
* @param mailbox The mailbox object
|
* @param mailbox The mailbox object
|
||||||
* @param qr The text of the scanned QR code. Typically, the same string as given
|
* @param qr The text of the scanned QR code. Typically, the same string as given
|
||||||
* to mrmailbox_check_qr().
|
* to dc_check_qr().
|
||||||
*
|
*
|
||||||
* @return 0=Out-of-band verification failed or aborted, 1=Out-of-band
|
* @return 0=Out-of-band verification failed or aborted, 1=Out-of-band
|
||||||
* verification successfull, the UI may redirect to the corresponding chat
|
* verification successfull, the UI may redirect to the corresponding chat
|
||||||
|
@ -468,7 +468,7 @@ cleanup:
|
||||||
* - for a qr-scan to add a contact (even without handshake), opening the created normal-chat is better
|
* - for a qr-scan to add a contact (even without handshake), opening the created normal-chat is better
|
||||||
* (for vg-request always the new group is shown, this is perfect)
|
* (for vg-request always the new group is shown, this is perfect)
|
||||||
*/
|
*/
|
||||||
uint32_t mrmailbox_join_securejoin(mrmailbox_t* mailbox, const char* qr)
|
uint32_t dc_join_securejoin(dc_context_t* mailbox, const char* qr)
|
||||||
{
|
{
|
||||||
/* ==========================================================
|
/* ==========================================================
|
||||||
==== Bob - the joiner's side =====
|
==== Bob - the joiner's side =====
|
||||||
|
|
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
|
* 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;
|
* set up with the current state of a message. The message object is not updated;
|
||||||
* to achieve this, you have to recreate it.
|
* to achieve this, you have to recreate it.
|
||||||
*
|
*
|
||||||
* @private @memberof mrmsg_t
|
* @private @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @return The created message object.
|
* @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 */
|
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.
|
* @param msg The message object to free.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @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 ) {
|
if( msg==NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -82,13 +82,13 @@ void mrmsg_unref(mrmsg_t* msg)
|
||||||
/**
|
/**
|
||||||
* Empty a message object.
|
* Empty a message object.
|
||||||
*
|
*
|
||||||
* @private @memberof mrmsg_t
|
* @private @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object to empty.
|
* @param msg The message object to empty.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return;
|
return;
|
||||||
|
@ -119,13 +119,13 @@ void mrmsg_empty(mrmsg_t* msg)
|
||||||
/**
|
/**
|
||||||
* Get the ID of the message.
|
* Get the ID of the message.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return the ID of the message, 0 on errors.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -137,20 +137,20 @@ uint32_t mrmsg_get_id(const mrmsg_t* msg)
|
||||||
/**
|
/**
|
||||||
* Get the ID of contact who wrote the message.
|
* 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.
|
* 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,
|
* 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.
|
* @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.
|
* 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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
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.
|
* Get the ID of chat the message belongs to.
|
||||||
* To get details about the chat, pass the returned ID to mrmailbox_get_chat().
|
* To get details about the chat, pass the returned ID to dc_get_chat().
|
||||||
* If a message is still in the deaddrop, the ID MR_CHAT_ID_DEADDROP is returned
|
* If a message is still in the deaddrop, the ID DC_CHAT_ID_DEADDROP is returned
|
||||||
* although internally another ID is used.
|
* although internally another ID is used.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return the ID of the chat the message belongs to, 0 on errors.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -183,15 +183,15 @@ uint32_t mrmsg_get_chat_id(const mrmsg_t* msg)
|
||||||
/**
|
/**
|
||||||
* Get the type of the message.
|
* Get the type of the message.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return One of MR_MSG_TEXT (10), MR_MSG_IMAGE (20), MR_MSG_GIF (21),
|
* @return One of DC_MSG_TEXT (10), DC_MSG_IMAGE (20), DC_MSG_GIF (21),
|
||||||
* MR_MSG_AUDIO (40), MR_MSG_VOICE (41), MR_MSG_VIDEO (50), MR_MSG_FILE (60)
|
* DC_MSG_AUDIO (40), DC_MSG_VOICE (41), DC_MSG_VIDEO (50), DC_MSG_FILE (60)
|
||||||
* or MR_MSG_UNDEFINED (0) if the type is undefined.
|
* 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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return MR_MSG_UNDEFINED;
|
return MR_MSG_UNDEFINED;
|
||||||
|
@ -204,32 +204,32 @@ int mrmsg_get_type(const mrmsg_t* msg)
|
||||||
* Get the state of a message.
|
* Get the state of a message.
|
||||||
*
|
*
|
||||||
* Incoming message states:
|
* 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.
|
* - 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.
|
||||||
* - 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.
|
* - 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.
|
||||||
* - 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_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:
|
* 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).
|
* 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)
|
* - DC_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_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.
|
* 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 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.
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return The state of the message.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return MR_STATE_UNDEFINED;
|
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),
|
* 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.
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return The time of the message.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
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
|
* result eg. from decoding errors (assume some bytes missing in a mime structure, forcing
|
||||||
* an attachment to be plain text).
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return Message text. The result must be free()'d. Never returns NULL.
|
* @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;
|
char* ret;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ char* mrmsg_get_text(const mrmsg_t* msg)
|
||||||
* Typically files are associated with images, videos, audios, documents.
|
* Typically files are associated with images, videos, audios, documents.
|
||||||
* Plain text messages do not have a file.
|
* Plain text messages do not have a file.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @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
|
* 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.
|
* 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;
|
char* ret = NULL;
|
||||||
|
|
||||||
|
@ -327,9 +327,9 @@ cleanup:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get base file name without path. The base file name includes the extension; the path
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
|
@ -337,7 +337,7 @@ cleanup:
|
||||||
* associated with the message, an empty string is returned. The returned
|
* associated with the message, an empty string is returned. The returned
|
||||||
* value must be free()'d.
|
* 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;
|
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
|
* 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.
|
* in doubt, `application/octet-stream` is returned. NULL is never returned.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return String containing the mime type. Must be free()'d after usage. NULL is never returned.
|
* @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* ret = NULL;
|
||||||
char* file = NULL;
|
char* file = NULL;
|
||||||
|
@ -403,13 +403,13 @@ cleanup:
|
||||||
*
|
*
|
||||||
* Typically, this is used to show the size of document messages, eg. a PDF.
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return File size in bytes, 0 if not applicable or on errors.
|
* @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;
|
uint64_t ret = 0;
|
||||||
char* file = NULL;
|
char* file = NULL;
|
||||||
|
@ -434,24 +434,24 @@ cleanup:
|
||||||
/**
|
/**
|
||||||
* Get real author and title.
|
* 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.
|
* 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.
|
* 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.
|
* 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.
|
* 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.
|
* @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();
|
mrlot_t* ret = mrlot_new();
|
||||||
char* pathNfilename = NULL;
|
char* pathNfilename = NULL;
|
||||||
|
@ -502,17 +502,17 @@ cleanup:
|
||||||
* 0 is returned.
|
* 0 is returned.
|
||||||
*
|
*
|
||||||
* Often the ascpect ratio is the more interesting thing. You can calculate
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return Width in pixels, if applicable. 0 otherwise or if unknown.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -527,17 +527,17 @@ int mrmsg_get_width(const mrmsg_t* msg)
|
||||||
* 0 is returned.
|
* 0 is returned.
|
||||||
*
|
*
|
||||||
* Often the ascpect ratio is the more interesting thing. You can calculate
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return Height in pixels, if applicable. 0 otherwise or if unknown.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
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,
|
* If the duration is unknown or if the associated file is no audio or video file,
|
||||||
* 0 is returned.
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return Duration in milliseconds, if applicable. 0 otherwise or if unknown.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -571,13 +571,13 @@ int mrmsg_get_duration(const mrmsg_t* msg)
|
||||||
/**
|
/**
|
||||||
* Check if a padlock should be shown beside the message.
|
* Check if a padlock should be shown beside the message.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return 1=padlock should be shown beside message, 0=do not show a padlock beside the message.
|
* @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 */
|
/* a padlock guarantees that the message is e2ee _and_ answers will be as well */
|
||||||
int show_encryption_state = 0;
|
int show_encryption_state = 0;
|
||||||
|
@ -608,33 +608,33 @@ int mrmsg_get_showpadlock(const mrmsg_t* msg)
|
||||||
/**
|
/**
|
||||||
* Get a summary for a message.
|
* 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.
|
* The string may be colored by having a look at m_text1_meaning.
|
||||||
* If the name should not be displayed, the element is NULL.
|
* 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.
|
* - dc_lot_t::m_text1_meaning: one of DC_TEXT1_USERNAME or DC_TEXT1_SELF.
|
||||||
* Typically used to show mrlot_t::m_text1 with different colors. 0 if not applicable.
|
* 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 msg The message object.
|
||||||
*
|
*
|
||||||
* @param chat To speed up things, pass an already available chat object here.
|
* @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.
|
* 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();
|
mrlot_t* ret = mrlot_new();
|
||||||
mrcontact_t* contact = NULL;
|
mrcontact_t* contact = NULL;
|
||||||
|
@ -668,7 +668,7 @@ cleanup:
|
||||||
* Get a message summary as a single line of text. Typically used for
|
* Get a message summary as a single line of text. Typically used for
|
||||||
* notifications.
|
* notifications.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
|
@ -677,7 +677,7 @@ cleanup:
|
||||||
* @return A summary for the given messages. The returned string must be free()'d.
|
* @return A summary for the given messages. The returned string must be free()'d.
|
||||||
* Returns an empty string on errors, never returns NULL.
|
* 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 ) {
|
if( msg==NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return safe_strdup(NULL);
|
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.
|
* Check if a message was sent successfully.
|
||||||
*
|
*
|
||||||
* Currently, "sent" messages are messages that are in the state "delivered" or "mdn received",
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return 1=message sent successfully, 0=message not yet sent or message is an incoming message.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
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
|
* with a "star" or something like that. Starred messages can typically be shown
|
||||||
* easily and are not deleted automatically.
|
* easily and are not deleted automatically.
|
||||||
*
|
*
|
||||||
* To star one or more messages, use mrmailbox_star_msgs(), to get a list of starred messages,
|
* To star one or more messages, use dc_star_msgs(), to get a list of starred messages,
|
||||||
* use mrmailbox_get_chat_msgs() using MR_CHAT_ID_STARRED as the chat_id.
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return 1=message is starred, 0=message not starred.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -731,7 +731,6 @@ int mrmsg_is_starred(const mrmsg_t* msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the message is a forwarded message.
|
* 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,
|
* "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)
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return 1=message is a forwarded message, 0=message not forwarded.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
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
|
* 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
|
* 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()
|
* created due to other actions, eg. dc_set_chat_name(), dc_set_chat_profile_image()
|
||||||
* or mrmailbox_add_contact_to_chat().
|
* or dc_add_contact_to_chat().
|
||||||
*
|
*
|
||||||
* These messages are typically shown in the center of the chat view,
|
* 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.
|
* 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.
|
* Typically, these messages are displayed in the center of the chat.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg The message object.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return 1=message is a system command, 0=normal message
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC ) {
|
||||||
return 0;
|
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.
|
* 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
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return 1=message is a setup message, 0=no setup message.
|
* @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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC || msg->m_type != MR_MSG_FILE ) {
|
||||||
return 0;
|
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.
|
* 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.
|
* 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 check, if a message is a setup message, use dc_msg_is_setupmessage().
|
||||||
* To decrypt a secret key from a setup message, use mrmailbox_continue_key_transfer().
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
* @return Typically, the first two digits of the setup code or an empty string if unknown.
|
* @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.
|
* 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* filename = NULL;
|
||||||
char* buf = NULL;
|
char* buf = NULL;
|
||||||
|
@ -882,7 +881,7 @@ cleanup:
|
||||||
" m.param,m.starred,m.hidden,c.blocked "
|
" 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);
|
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.
|
* 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;
|
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.
|
* 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 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.
|
* 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.
|
* @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;
|
int is_increation = 0;
|
||||||
if( MR_MSG_NEEDS_ATTACHMENT(msg->m_type) )
|
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
|
* Typically, this is used for videos that should be recoded by the user before
|
||||||
* they can be sent.
|
* they can be sent.
|
||||||
*
|
*
|
||||||
* @memberof mrmsg_t
|
* @memberof dc_msg_t
|
||||||
*
|
*
|
||||||
* @param msg the message object
|
* @param msg the message object
|
||||||
*
|
*
|
||||||
* @return 1=message is still in creation (`<filename>.increation` exists),
|
* @return 1=message is still in creation (`<filename>.increation` exists),
|
||||||
* 0=message no longer in creation
|
* 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 */
|
/* surrounds mrmsg_is_increation__() with locking and error checking */
|
||||||
int is_increation = 0;
|
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 ) {
|
if( msg == NULL || msg->m_magic != MR_MSG_MAGIC || msg->m_mailbox == NULL || msg->m_mailbox->m_sql == NULL ) {
|
||||||
return;
|
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
|
* If, in these cases, the frontend can provide the information, it can save
|
||||||
* them together with the message object for later usage.
|
* 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.
|
* 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.
|
* @param msg The message object.
|
||||||
*
|
*
|
||||||
|
@ -1192,7 +1191,7 @@ void mrmsg_save_param_to_disk__(mrmsg_t* msg)
|
||||||
*
|
*
|
||||||
* @return None.
|
* @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;
|
int locked = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue