add dc_msg_set_override_sender_name() api

with mailinglists, we already receive and handle per-message-names,
this api allows this also eg. for bots based on the deltachat api.
This commit is contained in:
B. Petersen
2021-02-14 00:21:22 +01:00
committed by bjoern
parent 57841cdcc0
commit 5c684eb3c1
4 changed files with 83 additions and 1 deletions

View File

@@ -3816,6 +3816,21 @@ void dc_msg_set_text (dc_msg_t* msg, const char* text);
void dc_msg_set_html (dc_msg_t* msg, const char* html);
/**
* Set different sender name for a message.
* This overrides the name set by the dc_set_config()-option `displayname`.
*
* Usually, this function is not needed
* when implementing pure messaging functions.
* However, it might be useful for bots eg. building bridges to other networks.
*
* @memberof dc_msg_t
* @param msg The message object.
* @param name The name to send along with the message.
*/
void dc_msg_set_override_sender_name(dc_msg_t* msg, const char* name);
/**
* Set the file associated with a message object.
* This does not alter any information in the database

View File

@@ -3028,6 +3028,21 @@ pub unsafe extern "C" fn dc_msg_set_html(msg: *mut dc_msg_t, html: *const libc::
ffi_msg.message.set_html(to_opt_string_lossy(html))
}
#[no_mangle]
pub unsafe extern "C" fn dc_msg_set_override_sender_name(
msg: *mut dc_msg_t,
name: *const libc::c_char,
) {
if msg.is_null() {
eprintln!("ignoring careless call to dc_msg_set_override_sender_name()");
return;
}
let ffi_msg = &mut *msg;
ffi_msg
.message
.set_override_sender_name(to_opt_string_lossy(name))
}
#[no_mangle]
pub unsafe extern "C" fn dc_msg_set_file(
msg: *mut dc_msg_t,