add dc_skip_device_msg() and belonging tests

This commit is contained in:
B. Petersen
2019-11-18 16:01:15 +01:00
parent fed6f4ab8a
commit 035da9e5d7
4 changed files with 98 additions and 5 deletions

View File

@@ -849,6 +849,24 @@ pub unsafe extern "C" fn dc_add_device_msg_once(
.unwrap_or(0)
}
#[no_mangle]
pub unsafe extern "C" fn dc_skip_device_msg(
context: *mut dc_context_t,
label: *const libc::c_char,
) {
if context.is_null() || label.is_null() {
eprintln!("ignoring careless call to dc_skip_device_msg()");
return;
}
let ffi_context = &mut *context;
ffi_context
.with_inner(|ctx| {
chat::skip_device_msg(ctx, &to_string_lossy(label))
.unwrap_or_log_default(ctx, "Failed to skip device message")
})
.unwrap_or(())
}
#[no_mangle]
pub unsafe extern "C" fn dc_get_draft(context: *mut dc_context_t, chat_id: u32) -> *mut dc_msg_t {
if context.is_null() {