diff --git a/coreapi/carddav.c b/coreapi/carddav.c index 1bd3b3378..0e8b678ad 100644 --- a/coreapi/carddav.c +++ b/coreapi/carddav.c @@ -116,6 +116,8 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList * lf->subscribe = lf2->subscribe; lf->refkey = ms_strdup(lf2->refkey); lf->presence_received = lf2->presence_received; + lf->lc = lf2->lc; + lf->friend_list = lf2->friend_list; if (cdc->contact_updated_cb) { ms_debug("Contact updated: %s", linphone_friend_get_name(lf)); diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index df48f116b..4320c81de 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -518,14 +518,14 @@ static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new, LinphoneFriendList *lfl = cdc->friend_list; MSList *elem = ms_list_find(lfl->friends, lf_old); if (elem) { - lf_old->friend_list = NULL; - linphone_friend_unref(lf_old); - lfl->friends = ms_list_remove_link(lfl->friends, elem); + elem->data = linphone_friend_ref(lf_new); } - linphone_friend_list_import_friend(lfl, lf_new, FALSE); + linphone_core_store_friend_in_db(lf_new->lc, lf_new); + if (cdc->friend_list->cbs->contact_updated_cb) { cdc->friend_list->cbs->contact_updated_cb(lfl, lf_new, lf_old); } + linphone_friend_unref(lf_old); } } diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 930c06dcc..9b7b2c30f 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -436,6 +436,7 @@ static void carddav_contact_deleted(LinphoneFriendList *list, LinphoneFriend *lf static void carddav_contact_updated(LinphoneFriendList *list, LinphoneFriend *new_friend, LinphoneFriend *old_friend) { LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)linphone_friend_list_cbs_get_user_data(list->cbs); + BC_ASSERT_STRING_EQUAL(linphone_vcard_get_full_name(linphone_friend_get_vcard(new_friend)), linphone_vcard_get_full_name(linphone_friend_get_vcard(old_friend))); stats->updated_contact_count++; }