From cb1b69f2eb8e281723f39886c056398b24604cbf Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 16 Sep 2013 09:25:31 +0200 Subject: [PATCH] Add linphone_friend_get_name(). --- coreapi/friend.c | 8 +++++++- coreapi/linphonefriend.h | 35 ++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/coreapi/friend.c b/coreapi/friend.c index 7b685a408..f5b6f626c 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -207,7 +207,7 @@ void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char } } -int linphone_friend_set_addr(LinphoneFriend *lf, const LinphoneAddress *addr){ +int linphone_friend_set_address(LinphoneFriend *lf, const LinphoneAddress *addr){ LinphoneAddress *fr=linphone_address_clone(addr); linphone_address_clean(fr); if (lf->uri!=NULL) linphone_address_destroy(lf->uri); @@ -288,6 +288,12 @@ const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf){ return lf->uri; } +const char * linphone_friend_get_name(const LinphoneFriend *lf) { + LinphoneAddress *fr = lf->uri; + if (fr == NULL) return NULL; + return linphone_address_get_display_name(fr); +} + bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf){ return lf->subscribe; } diff --git a/coreapi/linphonefriend.h b/coreapi/linphonefriend.h index 61fd33f2a..ae5c13dc9 100644 --- a/coreapi/linphonefriend.h +++ b/coreapi/linphonefriend.h @@ -101,11 +101,10 @@ typedef enum _LinphoneOnlineStatus{ * Pending */ LinphoneStatusPending, - - /** - * Vacation - */ - LinphoneStatusVacation, + /** + * Vacation + */ + LinphoneStatusVacation, LinphoneStatusEnd }LinphoneOnlineStatus; @@ -136,25 +135,39 @@ LINPHONE_PUBLIC LinphoneFriend *linphone_friend_new_with_addr(const char *addr); LINPHONE_PUBLIC void linphone_friend_destroy(LinphoneFriend *lf); /** - * set #LinphoneAddress for this friend + * Set #LinphoneAddress for this friend * @param fr #LinphoneFriend object * @param address #LinphoneAddress */ -LINPHONE_PUBLIC int linphone_friend_set_addr(LinphoneFriend *fr, const LinphoneAddress* address); +LINPHONE_PUBLIC int linphone_friend_set_address(LinphoneFriend *fr, const LinphoneAddress* address); /** - * set the display name for this friend + * Set #LinphoneAddress for this friend + * @deprecated Use #linphone_friend_set_address instead + */ +#define linphone_friend_set_addr linphone_friend_set_address + +/** + * Get address of this friend + * @param lf #LinphoneFriend object + * @return #LinphoneAddress + */ +LINPHONE_PUBLIC const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf); + +/** + * Set the display name for this friend * @param lf #LinphoneFriend object * @param name */ LINPHONE_PUBLIC int linphone_friend_set_name(LinphoneFriend *lf, const char *name); /** - * get address of this friend + * Get the display name for this friend * @param lf #LinphoneFriend object - * @return #LinphoneAddress + * @return The display name of this friend */ -LINPHONE_PUBLIC const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf); +LINPHONE_PUBLIC const char * linphone_friend_get_name(const LinphoneFriend *lf); + /** * get subscription flag value * @param lf #LinphoneFriend object