make sure LinphoneFriend created on core always have core back pointer set

This commit is contained in:
Jehan Monnier 2016-02-03 15:49:25 +01:00
parent c0566bbad0
commit d678615e26
2 changed files with 18 additions and 4 deletions

View file

@ -483,13 +483,25 @@ void linphone_friend_done(LinphoneFriend *fr){
linphone_friend_apply(fr,fr->lc);
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc) {
return linphone_friend_new();
LinphoneFriend * lf = linphone_friend_new();
lf->lc = lc;
return lf;
}
LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address) {
return linphone_friend_new_with_address(address);
LinphoneFriend * lf = linphone_friend_new_with_address(address);
if (lf)
lf->lc = lc;
return lf;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
if ((lc->friendlist == NULL) || (linphone_friend_list_add_friend(lc->friendlist, lf) != LinphoneFriendListOK)) return;

View file

@ -118,15 +118,17 @@ typedef struct _LinphoneFriend LinphoneFriend;
/**
* Contructor
* @return a new empty #LinphoneFriend
* @deprecated use #linphone_core_create_friend instead
*/
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_new(void);
LINPHONE_PUBLIC MS2_DEPRECATED LinphoneFriend * linphone_friend_new(void); /*fix me me replace MS2_DEPRECATED by LINPHONE_DEPRECATED*/
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_address()
* @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink
* @deprecated use #linphone_core_create_friend_with_address instead
*/
LINPHONE_PUBLIC LinphoneFriend *linphone_friend_new_with_address(const char *addr);
LINPHONE_PUBLIC MS2_DEPRECATED LinphoneFriend *linphone_friend_new_with_address(const char *addr); /*fix me me replace MS2_DEPRECATED by LINPHONE_DEPRECATED*/
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_address()