Commit 90ddebf9 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed warning when importing vcard with name but no sip uri

parent cd6409da
......@@ -229,11 +229,12 @@ int linphone_friend_set_name(LinphoneFriend *lf, const char *name){
}
}
if (!fr) {
if (!fr && !vcard) {
ms_warning("linphone_friend_set_address() must be called before linphone_friend_set_name() to be able to set display name.");
return -1;
} else if (fr) {
linphone_address_set_display_name(fr, name);
}
linphone_address_set_display_name(fr, name);
return 0;
}
......@@ -860,7 +861,9 @@ LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVCard *vcard) {
linphone_address_unref(linphone_address);
}
}
linphone_friend_set_name(fr, name);
if (name) {
linphone_friend_set_name(fr, name);
}
return fr;
}
......
......@@ -313,7 +313,6 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis
ms_warning("Friend %s already in list [%s], ignored.", tmp ? tmp : "unknown", list->display_name);
if (tmp) ms_free(tmp);
} else {
lf->in_list = TRUE;
return linphone_friend_list_import_friend(list, lf);
}
return LinphoneFriendListOK;
......@@ -322,6 +321,7 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis
LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
if ((lf->lc != NULL) || (lf->uri == NULL)) return LinphoneFriendListInvalidFriend;
list->friends = ms_list_append(list->friends, linphone_friend_ref(lf));
lf->in_list = TRUE;
return LinphoneFriendListOK;
}
......
......@@ -252,14 +252,16 @@ static void carddav_sync(void) {
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
friends = linphone_core_get_friend_list(manager->lc);
BC_ASSERT_PTR_NOT_NULL_FATAL(friends);
lf = (LinphoneFriend *)friends->data;
linphone_carddav_put_vcard(c, lf);
BC_ASSERT_PTR_NOT_NULL(friends);
if (friends) {
lf = (LinphoneFriend *)friends->data;
linphone_carddav_put_vcard(c, lf);
wait_for_until(manager->lc, NULL, &stats->updated_contact_count, 1, 2000);
BC_ASSERT_EQUAL(stats->new_contact_count, 1, int, "%i");
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 2000);
BC_ASSERT_EQUAL(stats->sync_done_count, 2, int, "%i");
wait_for_until(manager->lc, NULL, &stats->updated_contact_count, 1, 2000);
BC_ASSERT_EQUAL(stats->new_contact_count, 1, int, "%i");
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 2000);
BC_ASSERT_EQUAL(stats->sync_done_count, 2, int, "%i");
}
ms_free(stats);
linphone_carddav_destroy(c);
......
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