Commit 4a88bb63 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fix presence tests

parent 03ca760d
......@@ -244,8 +244,7 @@ int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val){
return 0;
}
int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol)
{
int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol) {
fr->pol=pol;
return 0;
}
......@@ -563,7 +562,6 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
lc->subscribers = ms_list_remove(lc->subscribers, lf);
linphone_friend_unref(lf);
}
lf->lc = lc; /*I would prefer this to be done in linphone_friend_list_add_friend()*/
if (linphone_core_ready(lc)) linphone_friend_apply(lf, lc);
else lf->commit = TRUE;
linphone_friend_save(lf, lc);
......@@ -925,7 +923,6 @@ int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char *
LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard);
if (lf) {
if (LinphoneFriendListOK == linphone_friend_list_import_friend(linphone_core_get_default_friend_list(lc), lf)) {
lf->lc = lc;
count++;
}
linphone_friend_unref(lf);
......
......@@ -280,8 +280,8 @@ static void linphone_friend_list_destroy(LinphoneFriendList *list) {
if (list->event != NULL) linphone_event_unref(list->event);
if (list->uri != NULL) ms_free(list->uri);
if (list->cbs) linphone_friend_list_cbs_unref(list->cbs);
list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
if (list->dirty_friends_to_update) list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
if (list->friends) list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriendList);
......@@ -403,11 +403,14 @@ 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));
list->dirty_friends_to_update = ms_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
if (!lf->uri) {
ms_error("linphone_friend_list_import_friend(): invalid friend, no sip uri");
return LinphoneFriendListInvalidFriend;
}
lf->friend_list = list;
lf->lc = list->lc;
list->friends = ms_list_append(list->friends, linphone_friend_ref(lf));
list->dirty_friends_to_update = ms_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
#ifdef FRIENDS_SQL_STORAGE_ENABLED
linphone_core_store_friend_in_db(lf->lc, lf);
#endif
......
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