Commit f5f80c92 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Few fixes for when using friends without the database storage

parent f3e7ce47
......@@ -601,8 +601,13 @@ void linphone_friend_update_subscribes(LinphoneFriend *fr, LinphoneProxyConfig *
}
void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc) {
if (!lc) return;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
if (lc->friends_db_file) {
linphone_core_store_friend_in_db(lc, fr);
} else {
linphone_core_write_friends_config(lc);
}
#else
linphone_core_write_friends_config(lc);
#endif
......@@ -690,7 +695,6 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
}
if (linphone_core_ready(lc)) linphone_friend_apply(lf, lc);
else lf->commit = TRUE;
linphone_friend_save(lf, lc);
}
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *lf) {
......
......@@ -431,9 +431,7 @@ LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *
if (synchronize) {
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
linphone_friend_save(lf, lf->lc);
return LinphoneFriendListOK;
}
......@@ -466,6 +464,9 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
}
}
}
if (!list->lc->friends_db_file) {
linphone_core_write_friends_config(list->lc);
}
lf->friend_list = NULL;
linphone_friend_unref(lf);
......@@ -785,9 +786,6 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
}
vcards = ms_list_next(vcards);
}
#ifndef FRIENDS_SQL_STORAGE_ENABLED
linphone_core_write_friends_config(list->lc);
#endif
return count;
}
......@@ -821,9 +819,6 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
}
vcards = ms_list_next(vcards);
}
#ifndef FRIENDS_SQL_STORAGE_ENABLED
linphone_core_write_friends_config(list->lc);
#endif
return count;
}
......
......@@ -519,6 +519,13 @@ LINPHONE_PUBLIC void linphone_core_set_friends_database_path(LinphoneCore *lc, c
**/
LINPHONE_PUBLIC void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc);
/**
* Saves a friend either in database if configured, otherwise in linphonerc
* @param fr the linphone friend to save
* @param lc the linphone core
*/
void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc);
/**
* @}
*/
......
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