Commit d678615e authored by jehan's avatar jehan
Browse files

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

parent c0566bba
...@@ -483,13 +483,25 @@ void linphone_friend_done(LinphoneFriend *fr){ ...@@ -483,13 +483,25 @@ void linphone_friend_done(LinphoneFriend *fr){
linphone_friend_apply(fr,fr->lc); 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) { 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) { 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) { void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
if ((lc->friendlist == NULL) || (linphone_friend_list_add_friend(lc->friendlist, lf) != LinphoneFriendListOK)) return; if ((lc->friendlist == NULL) || (linphone_friend_list_add_friend(lc->friendlist, lf) != LinphoneFriendListOK)) return;
......
...@@ -118,15 +118,17 @@ typedef struct _LinphoneFriend LinphoneFriend; ...@@ -118,15 +118,17 @@ typedef struct _LinphoneFriend LinphoneFriend;
/** /**
* Contructor * Contructor
* @return a new empty #LinphoneFriend * @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() * 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 * @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 * @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() * Contructor same as linphone_friend_new() + linphone_friend_set_address()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment