mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Fix call logs read from database clearing in migration process.
This commit is contained in:
parent
1dbb7f5409
commit
44b2f6ada7
4 changed files with 16 additions and 12 deletions
|
|
@ -116,12 +116,14 @@ void call_logs_write_to_config_file(LinphoneCore *lc){
|
|||
}
|
||||
}
|
||||
|
||||
void call_logs_read_from_config_file(LinphoneCore *lc){
|
||||
bctbx_list_t * call_logs_read_from_config_file(LinphoneCore *lc){
|
||||
char logsection[32];
|
||||
int i;
|
||||
const char *tmp;
|
||||
uint64_t sec;
|
||||
LpConfig *cfg=lc->config;
|
||||
bctbx_list_t *call_logs;
|
||||
|
||||
for(i=0;;++i){
|
||||
snprintf(logsection,sizeof(logsection),"call_log_%i",i);
|
||||
if (lp_config_has_section(cfg,logsection)){
|
||||
|
|
@ -154,9 +156,10 @@ void call_logs_read_from_config_file(LinphoneCore *lc){
|
|||
cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0);
|
||||
tmp=lp_config_get_string(cfg,logsection,"call_id",NULL);
|
||||
if (tmp) cl->call_id=ms_strdup(tmp);
|
||||
lc->call_logs=bctbx_list_append(lc->call_logs,cl);
|
||||
call_logs=bctbx_list_append(call_logs,cl);
|
||||
}else break;
|
||||
}
|
||||
return call_logs;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1730,13 +1730,15 @@ static void ui_config_read(LinphoneCore *lc)
|
|||
{
|
||||
#ifndef SQLITE_STORAGE_ENABLED
|
||||
read_friends_from_rc(lc);
|
||||
lc->call_logs = call_logs_read_from_config_file(lc);
|
||||
#else
|
||||
if (!lc->friends_db) {
|
||||
read_friends_from_rc(lc);
|
||||
}
|
||||
if (!lc->logs_db) {
|
||||
lc->call_logs = call_logs_read_from_config_file(lc);
|
||||
}
|
||||
#endif
|
||||
|
||||
call_logs_read_from_config_file(lc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -4624,17 +4626,16 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
|
|||
return;
|
||||
}
|
||||
|
||||
// This is because there must have been a call previously to linphone_core_call_log_storage_init
|
||||
lc->call_logs = bctbx_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
|
||||
call_logs_read_from_config_file(lc);
|
||||
if (!lc->call_logs) {
|
||||
logs_to_migrate = call_logs_read_from_config_file(lc);
|
||||
if (!logs_to_migrate) {
|
||||
ms_warning("nothing to migrate, skipping...");
|
||||
return;
|
||||
}
|
||||
|
||||
logs_to_migrate = lc->call_logs;
|
||||
// This is because there must have been a call previously to linphone_core_call_log_storage_init
|
||||
lc->call_logs = bctbx_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
lc->call_logs = NULL;
|
||||
|
||||
// We can't use bctbx_list_for_each because logs_to_migrate are listed in the wrong order (latest first), and we want to store the logs latest last
|
||||
for (i = (int)bctbx_list_size(logs_to_migrate) - 1; i >= 0; i--) {
|
||||
LinphoneCallLog *log = (LinphoneCallLog *) bctbx_list_nth_data(logs_to_migrate, i);
|
||||
|
|
|
|||
|
|
@ -1254,7 +1254,7 @@ void _linphone_core_codec_config_write(LinphoneCore *lc);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
LINPHONE_PUBLIC void call_logs_read_from_config_file(LinphoneCore *lc);
|
||||
LINPHONE_PUBLIC bctbx_list_t * call_logs_read_from_config_file(LinphoneCore *lc);
|
||||
void call_logs_write_to_config_file(LinphoneCore *lc);
|
||||
void linphone_core_call_log_storage_init(LinphoneCore *lc);
|
||||
void linphone_core_call_log_storage_close(LinphoneCore *lc);
|
||||
|
|
|
|||
|
|
@ -4898,7 +4898,7 @@ static void call_logs_migrate(void) {
|
|||
}
|
||||
|
||||
laure->lc->call_logs = bctbx_list_free_with_data(laure->lc->call_logs, (void (*)(void*))linphone_call_log_unref);
|
||||
call_logs_read_from_config_file(laure->lc);
|
||||
laure->lc->call_logs = call_logs_read_from_config_file(laure->lc);
|
||||
BC_ASSERT_TRUE(bctbx_list_size(laure->lc->call_logs) == 0);
|
||||
|
||||
unlink(logs_db);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue