mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
add ffi for update_device_chats()
This commit is contained in:
@@ -1139,6 +1139,24 @@ void dc_set_draft (dc_context_t* context, uint32_t ch
|
|||||||
uint32_t dc_add_device_msg (dc_context_t* context, const char* label, dc_msg_t* msg);
|
uint32_t dc_add_device_msg (dc_context_t* context, const char* label, dc_msg_t* msg);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init device-messages and saved-messages chat.
|
||||||
|
* This function adds the device-chat and saved-messages chat
|
||||||
|
* and adds one or more welcome or update-messages.
|
||||||
|
* The ui can add messages on its own using dc_add_device_msg() -
|
||||||
|
* for ordering, either before or after or even without calling this function.
|
||||||
|
*
|
||||||
|
* Chat and message creation is done only once.
|
||||||
|
* So if the user has manually deleted things, they won't be re-created
|
||||||
|
* (however, not seen device messages are added and may re-create the device-chat).
|
||||||
|
*
|
||||||
|
* @memberof dc_context_t
|
||||||
|
* @param context The context as created by dc_context_new().
|
||||||
|
* @return None.
|
||||||
|
*/
|
||||||
|
void dc_update_device_chats (dc_context_t* context);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a device-message with a given label was ever added.
|
* Check if a device-message with a given label was ever added.
|
||||||
* Device-messages can be added dc_add_device_msg().
|
* Device-messages can be added dc_add_device_msg().
|
||||||
|
|||||||
@@ -851,6 +851,21 @@ pub unsafe extern "C" fn dc_add_device_msg(
|
|||||||
.unwrap_or(0)
|
.unwrap_or(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn dc_update_device_chats(context: *mut dc_context_t) {
|
||||||
|
if context.is_null() {
|
||||||
|
eprintln!("ignoring careless call to dc_update_device_chats()");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let ffi_context = &mut *context;
|
||||||
|
ffi_context
|
||||||
|
.with_inner(|ctx| {
|
||||||
|
ctx.update_device_chats()
|
||||||
|
.unwrap_or_log_default(ctx, "Failed to add device message")
|
||||||
|
})
|
||||||
|
.unwrap_or(())
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_was_device_msg_ever_added(
|
pub unsafe extern "C" fn dc_was_device_msg_ever_added(
|
||||||
context: *mut dc_context_t,
|
context: *mut dc_context_t,
|
||||||
|
|||||||
Reference in New Issue
Block a user