add dc_contact_get_auth_name()

This commit is contained in:
B. Petersen
2021-02-12 11:13:53 +01:00
committed by bjoern
parent 40d9a1ec22
commit ad640e163c
2 changed files with 32 additions and 0 deletions

View File

@@ -4031,6 +4031,28 @@ char* dc_contact_get_addr (const dc_contact_t* contact);
char* dc_contact_get_name (const dc_contact_t* contact);
/**
* Get original contact name.
* This is the name of the contact as defined by the contact themself.
* If the contact themself does not define such a name,
* an empty string is returned.
*
* This function is typically only needed for the controls that
* allow the local user to edit the name,
* eg. you want to show the original name somewhere in the edit dialog
* (you cannot use dc_contact_get_display_name() for that as
* this would return previously set edited names).
*
* In most other situations than the name-edit-dialog,
* as lists, messages etc. use dc_contact_get_display_name().
*
* @memberof dc_contact_t
* @return String with the original name, must be released using dc_str_unref().
* Empty string if unset, never returns NULL.
*/
char* dc_contact_get_auth_name (const dc_contact_t* contact);
/**
* Get display name. This is the name as defined by the contact himself,
* modified by the user or, if both are unset, the email address.

View File

@@ -3220,6 +3220,16 @@ pub unsafe extern "C" fn dc_contact_get_name(contact: *mut dc_contact_t) -> *mut
ffi_contact.contact.get_name().strdup()
}
#[no_mangle]
pub unsafe extern "C" fn dc_contact_get_auth_name(contact: *mut dc_contact_t) -> *mut libc::c_char {
if contact.is_null() {
eprintln!("ignoring careless call to dc_contact_get_auth_name()");
return "".strdup();
}
let ffi_contact = &*contact;
ffi_contact.contact.get_authname().strdup()
}
#[no_mangle]
pub unsafe extern "C" fn dc_contact_get_display_name(
contact: *mut dc_contact_t,