mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 20:46:28 +00:00
Few fixes for when using friends without the database storage
This commit is contained in:
parent
f3e7ce4770
commit
f5f80c92bd
3 changed files with 17 additions and 11 deletions
|
|
@ -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
|
||||
linphone_core_store_friend_in_db(lc, fr);
|
||||
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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue