Commit bdf6f37b authored by Erwan Croze's avatar Erwan Croze 👋🏻

Fix create a linphone friend list if not exist and make it as default in linphone_core_add_friend

parent 13e4797c
......@@ -881,7 +881,12 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
#endif
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
if (linphone_friend_list_add_friend(linphone_core_get_default_friend_list(lc), lf) != LinphoneFriendListOK) return;
LinphoneFriendList *fl = linphone_core_get_default_friend_list(lc);
if (fl == NULL) {
fl = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, fl);
}
if (linphone_friend_list_add_friend(fl, lf) != LinphoneFriendListOK) return;
if (bctbx_list_find(lc->subscribers, lf)) {
/*if this friend was in the pending subscriber list, now remove it from this list*/
lc->subscribers = bctbx_list_remove(lc->subscribers, lf);
......
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