mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Add dc_msg_get_ephemeral_{timer, timestamp}()
This commit is contained in:
committed by
link2xt
parent
8efe7cade7
commit
7da69a4644
@@ -3026,6 +3026,32 @@ int dc_msg_get_duration (const dc_msg_t* msg);
|
||||
int dc_msg_get_showpadlock (const dc_msg_t* msg);
|
||||
|
||||
|
||||
/**
|
||||
* Get ephemeral timer duration for message.
|
||||
*
|
||||
* To check if the timer is started and calculate remaining time,
|
||||
* use dc_msg_get_ephemeral_timestamp().
|
||||
*
|
||||
* @memberof dc_msg_t
|
||||
* @param msg The message object.
|
||||
* @return Duration in seconds, or 0 if no timer is set.
|
||||
*/
|
||||
uint32_t dc_msg_get_ephemeral_timer (const dc_msg_t* msg);
|
||||
|
||||
/**
|
||||
* Get timestamp of ephemeral message removal.
|
||||
*
|
||||
* If returned value is non-zero, you can calculate the * fraction of
|
||||
* time remaining by divinding the difference between the current timestamp
|
||||
* and this timestamp by dc_msg_get_ephemeral_timer().
|
||||
*
|
||||
* @memberof dc_msg_t
|
||||
* @param msg The message object.
|
||||
* @return Time of message removal, 0 if the timer is not started.
|
||||
*/
|
||||
int64_t dc_msg_get_ephemeral_timestamp (const dc_msg_t* msg);
|
||||
|
||||
|
||||
/**
|
||||
* Get a summary for a message.
|
||||
*
|
||||
|
||||
@@ -2675,6 +2675,26 @@ pub unsafe extern "C" fn dc_msg_get_showpadlock(msg: *mut dc_msg_t) -> libc::c_i
|
||||
ffi_msg.message.get_showpadlock() as libc::c_int
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_msg_get_ephemeral_timer(msg: *mut dc_msg_t) -> u32 {
|
||||
if msg.is_null() {
|
||||
eprintln!("ignoring careless call to dc_msg_get_ephemeral_timer()");
|
||||
return 0;
|
||||
}
|
||||
let ffi_msg = &*msg;
|
||||
ffi_msg.message.get_ephemeral_timer()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_msg_get_ephemeral_timestamp(msg: *mut dc_msg_t) -> i64 {
|
||||
if msg.is_null() {
|
||||
eprintln!("ignoring careless call to dc_msg_get_ephemeral_timer()");
|
||||
return 0;
|
||||
}
|
||||
let ffi_msg = &*msg;
|
||||
ffi_msg.message.get_ephemeral_timestamp()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_msg_get_summary(
|
||||
msg: *mut dc_msg_t,
|
||||
|
||||
Reference in New Issue
Block a user