diff --git a/coreapi/call_log.c b/coreapi/call_log.c index d66ad9a35..250f30b73 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -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); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3e2065c23..acdae7b48 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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); diff --git a/coreapi/private.h b/coreapi/private.h index 50ae8bec1..df9e3944b 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -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); diff --git a/mediastreamer2 b/mediastreamer2 index 42c880a83..ed6b331f6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 42c880a83ab98791979a3c178f6624dc19cbd898 +Subproject commit ed6b331f622f7ffd976e3faf0007c577d6f31eee