Commit 92d0a936 authored by Simon Morlat's avatar Simon Morlat

allow unlimited call log by default when sqlite storage is enabled

parent c71cfe46
......@@ -81,6 +81,8 @@ void call_logs_write_to_config_file(LinphoneCore *lc){
LpConfig *cfg=lc->config;
if (linphone_core_get_global_state (lc)==LinphoneGlobalStartup) return;
if (lc->max_call_logs == LINPHONE_MAX_CALL_HISTORY_UNLIMITED) return;
for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
......@@ -541,7 +543,11 @@ const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) {
if (!lc || lc->logs_db == NULL) return NULL;
buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %u", lc->max_call_logs);
if (lc->max_call_logs != LINPHONE_MAX_CALL_HISTORY_UNLIMITED){
buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %i", lc->max_call_logs);
}else{
buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC");
}
begin = ortp_get_cur_time_ms();
linphone_sql_request_call_log(lc->logs_db, buf, &result);
......
......@@ -1601,7 +1601,7 @@ static void misc_config_read(LinphoneCore *lc) {
LpConfig *config=lc->config;
const char *uuid;
lc->max_call_logs=(unsigned int)lp_config_get_int(config,"misc","history_max_size",30);
lc->max_call_logs=(unsigned int)lp_config_get_int(config,"misc","history_max_size",LINPHONE_MAX_CALL_HISTORY_SIZE);
lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS);
uuid=lp_config_get_string(config,"misc","uuid",NULL);
......
......@@ -962,7 +962,7 @@ struct _LinphoneCore
MSList *queued_calls; /* used by the autoreplier */
MSList *call_logs;
MSList *chatrooms;
unsigned int max_call_logs;
int max_call_logs;
int missed_calls;
VideoPreview *previewstream;
struct _MSEventQueue *msevq;
......@@ -1160,6 +1160,16 @@ void _linphone_core_codec_config_write(LinphoneCore *lc);
#ifndef NB_MAX_CALLS
#define NB_MAX_CALLS (10)
#endif
#define LINPHONE_MAX_CALL_HISTORY_UNLIMITED (-1)
#ifndef LINPHONE_MAX_CALL_HISTORY_SIZE
#ifdef SQLITE_STORAGE_ENABLED
#define LINPHONE_MAX_CALL_HISTORY_SIZE LINPHONE_MAX_CALL_HISTORY_UNLIMITED
#else
#define LINPHONE_MAX_CALL_HISTORY_SIZE 30
#endif
#endif
LINPHONE_PUBLIC void 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);
......
mediastreamer2 @ ed6b331f
Subproject commit 42c880a83ab98791979a3c178f6624dc19cbd898
Subproject commit ed6b331f622f7ffd976e3faf0007c577d6f31eee
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