diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index fe06906f5..b19d1d32d 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -4293,18 +4293,24 @@ dc_lot_t* dc_msg_get_summary (const dc_msg_t* msg, const dc_cha * @memberof dc_msg_t * @param msg The message object. * @param approx_characters A rough length of the expected string. - * @param full_summary 1=return full summary with all details, - * 0=skip type and "forwarded" prefixes as they're rendered by the UI alerady, - * used for pinned messages that show e.g. an image and do not need the type in the summary therefore. * @return A summary for the given messages. * The returned string must be released using dc_str_unref(). * Returns an empty string on errors, never returns NULL. */ -char* dc_msg_get_summary_text (const dc_msg_t* msg, int approx_characters, int with_emoji); +char* dc_msg_get_summarytext (const dc_msg_t* msg, int approx_characters); -// depreacted 2026-10-07, the old variant took a string length as second parameter, which is converted to true. -#define dc_msg_get_summarytext(a, b) dc_msg_get_summary_text((a), (b), true) +/** + * Get a message summary as a single line of text, skipping emoji or "Forwarded" prefixes. + * Used for pinned messages that show e.g. an image and do not need the type in the summary therefore. + * + * @memberof dc_msg_t + * @param msg The message object. + * @return A summary for the given messages. + * The returned string must be released using dc_str_unref(). + * Returns an empty string on errors, never returns NULL. + */ +char* dc_msg_get_summarytext_without_prefix (const dc_msg_t* msg); /** diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index cf7977af0..397a64aa7 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -3473,13 +3473,12 @@ pub unsafe extern "C" fn dc_msg_get_summary( } #[unsafe(no_mangle)] -pub unsafe extern "C" fn dc_msg_get_summary_text( +pub unsafe extern "C" fn dc_msg_get_summarytext( msg: *mut dc_msg_t, approx_characters: libc::c_int, - full_summary: libc::c_int, ) -> *mut libc::c_char { if msg.is_null() { - eprintln!("ignoring careless call to dc_msg_get_summary_text()"); + eprintln!("ignoring careless call to dc_msg_get_summarytext()"); return "".strdup(); } let ffi_msg = unsafe { &mut *msg }; @@ -3487,12 +3486,30 @@ pub unsafe extern "C" fn dc_msg_get_summary_text( block_on(ffi_msg.message.get_summary_text_ext( &ffi_msg.context, approx_characters as usize, - full_summary != 0, - full_summary != 0, + true, + true, )) .strdup() } +#[unsafe(no_mangle)] +pub unsafe extern "C" fn dc_msg_get_summarytext_without_prefix( + msg: *mut dc_msg_t, +) -> *mut libc::c_char { + if msg.is_null() { + eprintln!("ignoring careless call to dc_msg_get_summarytext_without_prefix()"); + return "".strdup(); + } + let ffi_msg = unsafe { &mut *msg }; + + block_on( + ffi_msg + .message + .get_summary_text_ext(&ffi_msg.context, 2000, false, false), + ) + .strdup() +} + #[unsafe(no_mangle)] pub unsafe extern "C" fn dc_msg_get_override_sender_name(msg: *mut dc_msg_t) -> *mut libc::c_char { if msg.is_null() { diff --git a/python/src/deltachat/message.py b/python/src/deltachat/message.py index 9052e2493..c89ad0a3f 100644 --- a/python/src/deltachat/message.py +++ b/python/src/deltachat/message.py @@ -188,7 +188,7 @@ class Message: def get_summarytext(self, width: int) -> str: """Get a message summary as a single line of text. Typically used for notifications.""" - return from_dc_charpointer(lib.dc_msg_get_summary_text(self._dc_msg, width, True)) + return from_dc_charpointer(lib.dc_msg_get_summarytext(self._dc_msg, width)) @props.with_doc def time_sent(self):