Commit e2560d60 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

More work on documentation + modified JAVA wrapper to ensure all returned...

More work on documentation + modified JAVA wrapper to ensure all returned arrays are never null even if the C API says maybenil
parent 96713ea4
......@@ -2133,12 +2133,12 @@ static int lpc_cmd_param(LinphoneCore *lc, char *args)
switch (sscanf(args,"%19s %19s %49s",section,param,value)) {
// case 1 might show all current settings under a section
case 2:
string = lp_config_get_string(linphone_core_get_config(lc), section, param, "(undef)");
string = linphone_config_get_string(linphone_core_get_config(lc), section, param, "(undef)");
linphonec_out("current value: %s\n", string);
break;
case 3:
if (lp_config_get_string(linphone_core_get_config(lc), section, param, NULL) != NULL) {
lp_config_set_string(linphone_core_get_config(lc), section, param, value);
if (linphone_config_get_string(linphone_core_get_config(lc), section, param, NULL) != NULL) {
linphone_config_set_string(linphone_core_get_config(lc), section, param, value);
// no indication of existence
linphonec_out("updated value: %s\n", value);
} else {
......@@ -2334,16 +2334,16 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
n = sscanf(arg2, "%d %d %d", &delay, &tail_len, &frame_size);
if (n == 1) {
lp_config_set_int(config,"sound","ec_delay",delay);
linphone_config_set_int(config,"sound","ec_delay",delay);
}
else if (n == 2) {
lp_config_set_int(config,"sound","ec_delay",delay);
lp_config_set_int(config,"sound","ec_tail_len",tail_len);
linphone_config_set_int(config,"sound","ec_delay",delay);
linphone_config_set_int(config,"sound","ec_tail_len",tail_len);
}
else if (n == 3) {
lp_config_set_int(config,"sound","ec_delay",delay);
lp_config_set_int(config,"sound","ec_tail_len",tail_len);
lp_config_set_int(config,"sound","ec_framesize",frame_size);
linphone_config_set_int(config,"sound","ec_delay",delay);
linphone_config_set_int(config,"sound","ec_tail_len",tail_len);
linphone_config_set_int(config,"sound","ec_framesize",frame_size);
}
}
}
......@@ -2353,9 +2353,9 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
else if (strcmp(arg1,"show")==0){
linphonec_out("echo cancellation is %s; delay %d, tail length %d, frame size %d\n",
linphone_core_echo_cancellation_enabled(lc) ? "on" : "off",
lp_config_get_int(config,"sound","ec_delay",0),
lp_config_get_int(config,"sound","ec_tail_len",0),
lp_config_get_int(config,"sound","ec_framesize",0));
linphone_config_get_int(config,"sound","ec_delay",0),
linphone_config_get_int(config,"sound","ec_tail_len",0),
linphone_config_get_int(config,"sound","ec_framesize",0));
}
else {
return 0;
......
......@@ -380,13 +380,13 @@ LinphoneAccountCreator * _linphone_account_creator_new(LinphoneCore *core, const
static void fill_domain_and_algorithm_if_needed(LinphoneAccountCreator *creator) {
if (creator->domain == NULL) {
const char* domain = lp_config_get_string(linphone_core_get_config(creator->core), "assistant", "domain", NULL);
const char* domain = linphone_config_get_string(linphone_core_get_config(creator->core), "assistant", "domain", NULL);
if (domain) {
linphone_account_creator_set_domain(creator, domain);
}
}
if (creator->algorithm == NULL) {
const char* algorithm = lp_config_get_string(linphone_core_get_config(creator->core), "assistant", "algorithm", NULL);
const char* algorithm = linphone_config_get_string(linphone_core_get_config(creator->core), "assistant", "algorithm", NULL);
if (algorithm) {
linphone_account_creator_set_algorithm(creator, algorithm);
}
......@@ -449,10 +449,10 @@ void linphone_account_creator_set_proxy_config(LinphoneAccountCreator *creator,
}
LinphoneAccountCreatorUsernameStatus linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username) {
int min_length = lp_config_get_int(linphone_core_get_config(creator->core), "assistant", "username_min_length", -1);
int max_length = lp_config_get_int(linphone_core_get_config(creator->core), "assistant", "username_max_length", -1);
bool_t use_phone_number = !!lp_config_get_int(linphone_core_get_config(creator->core), "assistant", "use_phone_number", 0);
const char* regex = lp_config_get_string(linphone_core_get_config(creator->core), "assistant", "username_regex", 0);
int min_length = linphone_config_get_int(linphone_core_get_config(creator->core), "assistant", "username_min_length", -1);
int max_length = linphone_config_get_int(linphone_core_get_config(creator->core), "assistant", "username_max_length", -1);
bool_t use_phone_number = !!linphone_config_get_int(linphone_core_get_config(creator->core), "assistant", "use_phone_number", 0);
const char* regex = linphone_config_get_string(linphone_core_get_config(creator->core), "assistant", "username_regex", 0);
if (!username) {
resetField(&creator->username);
return LinphoneAccountCreatorUsernameStatusOk;
......@@ -533,8 +533,8 @@ const char * linphone_account_creator_get_phone_number(const LinphoneAccountCrea
}
LinphoneAccountCreatorPasswordStatus linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password) {
int min_length = lp_config_get_int(linphone_core_get_config(creator->core), "assistant", "password_min_length", -1);
int max_length = lp_config_get_int(linphone_core_get_config(creator->core), "assistant", "password_max_length", -1);
int min_length = linphone_config_get_int(linphone_core_get_config(creator->core), "assistant", "password_min_length", -1);
int max_length = linphone_config_get_int(linphone_core_get_config(creator->core), "assistant", "password_max_length", -1);
if (!password) {
resetField(&creator->password);
return LinphoneAccountCreatorPasswordStatusTooShort;
......@@ -763,10 +763,10 @@ LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account(Lin
LinphoneAccountCreatorStatus linphone_account_creator_constructor_linphone(LinphoneAccountCreator *creator) {
LinphoneAddress *addr;
const char *identity = lp_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "reg_identity", NULL);
const char *proxy = lp_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "reg_proxy", NULL);
const char *route = lp_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "reg_route", NULL);
const char *realm = lp_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "realm", NULL);
const char *identity = linphone_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "reg_identity", NULL);
const char *proxy = linphone_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "reg_proxy", NULL);
const char *route = linphone_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "reg_route", NULL);
const char *realm = linphone_config_get_default_string(linphone_core_get_config(creator->core), "proxy", "realm", NULL);
if (!creator->proxy_cfg) creator->proxy_cfg = linphone_core_create_proxy_config(creator->core);
linphone_proxy_config_set_realm(creator->proxy_cfg, realm ? realm : "sip.linphone.org");
......
......@@ -91,27 +91,27 @@ void call_logs_write_to_config_file(LinphoneCore *lc){
for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
snprintf(logsection,sizeof(logsection),"call_log_%i",i);
lp_config_clean_section(cfg,logsection);
lp_config_set_int(cfg,logsection,"dir",cl->dir);
lp_config_set_int(cfg,logsection,"status",cl->status);
linphone_config_clean_section(cfg,logsection);
linphone_config_set_int(cfg,logsection,"dir",cl->dir);
linphone_config_set_int(cfg,logsection,"status",cl->status);
tmp=linphone_address_as_string(cl->from);
lp_config_set_string(cfg,logsection,"from",tmp);
linphone_config_set_string(cfg,logsection,"from",tmp);
ms_free(tmp);
tmp=linphone_address_as_string(cl->to);
lp_config_set_string(cfg,logsection,"to",tmp);
linphone_config_set_string(cfg,logsection,"to",tmp);
ms_free(tmp);
if (cl->start_date_time)
lp_config_set_int64(cfg,logsection,"start_date_time",(int64_t)cl->start_date_time);
else lp_config_set_string(cfg,logsection,"start_date",cl->start_date);
lp_config_set_int(cfg,logsection,"duration",cl->duration);
if (cl->refkey) lp_config_set_string(cfg,logsection,"refkey",cl->refkey);
lp_config_set_float(cfg,logsection,"quality",cl->quality);
lp_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled);
lp_config_set_string(cfg,logsection,"call_id",cl->call_id);
linphone_config_set_int64(cfg,logsection,"start_date_time",(int64_t)cl->start_date_time);
else linphone_config_set_string(cfg,logsection,"start_date",cl->start_date);
linphone_config_set_int(cfg,logsection,"duration",cl->duration);
if (cl->refkey) linphone_config_set_string(cfg,logsection,"refkey",cl->refkey);
linphone_config_set_float(cfg,logsection,"quality",cl->quality);
linphone_config_set_int(cfg,logsection,"video_enabled", cl->video_enabled);
linphone_config_set_string(cfg,logsection,"call_id",cl->call_id);
}
for(;i<lc->max_call_logs;++i){
snprintf(logsection,sizeof(logsection),"call_log_%i",i);
lp_config_clean_section(cfg,logsection);
linphone_config_clean_section(cfg,logsection);
}
}
......@@ -125,36 +125,36 @@ bctbx_list_t * linphone_core_read_call_logs_from_config_file(LinphoneCore *lc){
for(i=0;;++i){
snprintf(logsection,sizeof(logsection),"call_log_%i",i);
if (lp_config_has_section(cfg,logsection)){
if (linphone_config_has_section(cfg,logsection)){
LinphoneCallLog *cl;
LinphoneAddress *from=NULL,*to=NULL;
tmp=lp_config_get_string(cfg,logsection,"from",NULL);
tmp=linphone_config_get_string(cfg,logsection,"from",NULL);
if (tmp) from=linphone_address_new(tmp);
tmp=lp_config_get_string(cfg,logsection,"to",NULL);
tmp=linphone_config_get_string(cfg,logsection,"to",NULL);
if (tmp) to=linphone_address_new(tmp);
if (!from || !to)
continue;
cl=linphone_call_log_new(static_cast<LinphoneCallDir>(lp_config_get_int(cfg,logsection,"dir",0)),from,to);
cl->status=static_cast<LinphoneCallStatus>(lp_config_get_int(cfg,logsection,"status",0));
sec=(uint64_t)lp_config_get_int64(cfg,logsection,"start_date_time",0);
cl=linphone_call_log_new(static_cast<LinphoneCallDir>(linphone_config_get_int(cfg,logsection,"dir",0)),from,to);
cl->status=static_cast<LinphoneCallStatus>(linphone_config_get_int(cfg,logsection,"status",0));
sec=(uint64_t)linphone_config_get_int64(cfg,logsection,"start_date_time",0);
if (sec) {
/*new call log format with date expressed in seconds */
cl->start_date_time=(time_t)sec;
set_call_log_date(cl,cl->start_date_time);
}else{
tmp=lp_config_get_string(cfg,logsection,"start_date",NULL);
tmp=linphone_config_get_string(cfg,logsection,"start_date",NULL);
if (tmp) {
strncpy(cl->start_date,tmp,sizeof(cl->start_date));
cl->start_date[sizeof(cl->start_date) - 1] = '\0';
cl->start_date_time=string_to_time(cl->start_date);
}
}
cl->duration=lp_config_get_int(cfg,logsection,"duration",0);
tmp=lp_config_get_string(cfg,logsection,"refkey",NULL);
cl->duration=linphone_config_get_int(cfg,logsection,"duration",0);
tmp=linphone_config_get_string(cfg,logsection,"refkey",NULL);
if (tmp) cl->refkey=ms_strdup(tmp);
cl->quality=lp_config_get_float(cfg,logsection,"quality",-1);
cl->video_enabled=!!lp_config_get_int(cfg,logsection,"video_enabled",0);
tmp=lp_config_get_string(cfg,logsection,"call_id",NULL);
cl->quality=linphone_config_get_float(cfg,logsection,"quality",-1);
cl->video_enabled=!!linphone_config_get_int(cfg,logsection,"video_enabled",0);
tmp=linphone_config_get_string(cfg,logsection,"call_id",NULL);
if (tmp) cl->call_id=ms_strdup(tmp);
call_logs=bctbx_list_append(call_logs,cl);
}else break;
......
......@@ -82,7 +82,7 @@ static void call_received(SalCallOp *h) {
LinphoneAddress *fromAddr = nullptr;
const char *pAssertedId = sal_custom_header_find(h->getRecvCustomHeaders(), "P-Asserted-Identity");
/* In some situation, better to trust the network rather than the UAC */
if (lp_config_get_int(linphone_core_get_config(lc), "sip", "call_logs_use_asserted_id_instead_of_from", 0)) {
if (linphone_config_get_int(linphone_core_get_config(lc), "sip", "call_logs_use_asserted_id_instead_of_from", 0)) {
if (pAssertedId) {
LinphoneAddress *pAssertedIdAddr = linphone_address_new(pAssertedId);
if (pAssertedIdAddr) {
......@@ -228,7 +228,7 @@ static void call_received(SalCallOp *h) {
return;
}
if (lp_config_get_int(linphone_core_get_config(lc), "sip", "reject_duplicated_calls", 1)){
if (linphone_config_get_int(linphone_core_get_config(lc), "sip", "reject_duplicated_calls", 1)){
/* Check if I'm the caller */
LinphoneAddress *fromAddressToSearchIfMe = nullptr;
if (h->getPrivacy() == SalPrivacyNone)
......
......@@ -424,7 +424,7 @@ RemoteConference::RemoteConference (LinphoneCore *core, const ConferenceParams *
m_focusContact = nullptr;
m_focusCall = nullptr;
m_coreCbs = nullptr;
m_focusAddr = lp_config_get_string(m_core->config, "misc", "conference_focus_addr", "");
m_focusAddr = linphone_config_get_string(m_core->config, "misc", "conference_focus_addr", "");
m_coreCbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_call_state_changed(m_coreCbs, callStateChangedCb);
linphone_core_cbs_set_transfer_state_changed(m_coreCbs, transferStateChanged);
......
......@@ -106,50 +106,50 @@ void linphone_dictionary_foreach(const LinphoneDictionary* obj, void (*apply_fun
belle_sip_dict_foreach(obj, apply_func, userdata);
}
struct lp_config_to_dict {
struct linphone_config_to_dict {
const char* section;
const LpConfig* config;
LinphoneDictionary* dict;
};
static void lp_config_section_to_dict_cb(const char*key, struct lp_config_to_dict* userdata)
static void linphone_config_section_to_dict_cb(const char*key, struct linphone_config_to_dict* userdata)
{
const char* value = lp_config_get_string(userdata->config, userdata->section, key, "");
const char* value = linphone_config_get_string(userdata->config, userdata->section, key, "");
linphone_dictionary_set_string(userdata->dict, key, value);
}
LinphoneDictionary* lp_config_section_to_dict(const LpConfig* lpconfig, const char* section)
LinphoneDictionary* linphone_config_section_to_dict(const LpConfig* lpconfig, const char* section)
{
LinphoneDictionary* dict = NULL;
struct lp_config_to_dict fd;
struct linphone_config_to_dict fd;
fd.config = lpconfig;
fd.section = section;
dict = linphone_dictionary_new();
fd.dict = dict;
lp_config_for_each_entry(lpconfig, section,
(void (*)(const char*, void*))lp_config_section_to_dict_cb,
linphone_config_for_each_entry(lpconfig, section,
(void (*)(const char*, void*))linphone_config_section_to_dict_cb,
&fd);
return dict;
}
struct lp_config_from_dict {
struct linphone_config_from_dict {
const char* section;
LpConfig* config;
};
static void lp_config_dict_dump_cb( const char* key, void* value, void* userdata)
static void linphone_config_dict_dump_cb( const char* key, void* value, void* userdata)
{
struct lp_config_from_dict* fd= (struct lp_config_from_dict*)userdata;
lp_config_set_string(fd->config, fd->section, key, (const char*)value);
struct linphone_config_from_dict* fd= (struct linphone_config_from_dict*)userdata;
linphone_config_set_string(fd->config, fd->section, key, (const char*)value);
}
void lp_config_load_dict_to_section(LpConfig* lpconfig, const char* section, const LinphoneDictionary* dict)
void linphone_config_load_dict_to_section(LpConfig* lpconfig, const char* section, const LinphoneDictionary* dict)
{
struct lp_config_from_dict pvdata = { section, lpconfig };
linphone_dictionary_foreach(dict,lp_config_dict_dump_cb, &pvdata);
struct linphone_config_from_dict pvdata = { section, lpconfig };
linphone_dictionary_foreach(dict,linphone_config_dict_dump_cb, &pvdata);
}
......
......@@ -319,9 +319,9 @@ int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibration
ms_error("Echo calibration is still on going !");
return -1;
}
rate = (unsigned int)lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000);
rate = (unsigned int)linphone_config_get_int(lc->config,"sound","echo_cancellation_rate",8000);
lc->ecc=ec_calibrator_new(lc->factory, lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,rate,cb,audio_init_cb,audio_uninit_cb,cb_data);
lc->ecc->play_cool_tones = !!lp_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0);
lc->ecc->play_cool_tones = !!linphone_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0);
ec_calibrator_start(lc->ecc);
return 0;
}
......@@ -350,12 +350,12 @@ LinphoneStatus linphone_core_start_echo_canceller_calibration(LinphoneCore *lc)
ms_error("Echo calibration is still on going !");
return -1;
}
rate = (unsigned int)lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000);
rate = (unsigned int)linphone_config_get_int(lc->config,"sound","echo_cancellation_rate",8000);
lc->ecc=ec_calibrator_new(lc->factory, lc->sound_conf.play_sndcard, lc->sound_conf.capt_sndcard, rate,
_ec_calibration_result_cb,
_ec_calibration_audio_init_cb,
_ec_calibration_audio_uninit_cb, lc);
lc->ecc->play_cool_tones = !!lp_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0);
lc->ecc->play_cool_tones = !!linphone_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0);
getPlatformHelpers(lc)->startAudioForEchoTestOrCalibration();
ec_calibrator_start(lc->ecc);
return 0;
......
......@@ -223,14 +223,14 @@ LinphoneReason linphone_event_get_reason(const LinphoneEvent *lev){
LinphoneEvent *linphone_core_create_subscribe(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires){
LinphoneEvent *lev=linphone_event_new(lc, LinphoneSubscriptionOutgoing, event, expires);
linphone_configure_op(lc,lev->op,resource,NULL,TRUE);
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
lev->op->setManualRefresherMode(!linphone_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
return lev;
}
LinphoneEvent *linphone_core_create_subscribe_2(LinphoneCore *lc, const LinphoneAddress *resource, LinphoneProxyConfig *cfg, const char *event, int expires){
LinphoneEvent *lev=linphone_event_new(lc, LinphoneSubscriptionOutgoing, event, expires);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL,TRUE,cfg);
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
lev->op->setManualRefresherMode(!linphone_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
return lev;
}
......@@ -348,8 +348,8 @@ LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, LinphoneProxyCo
lev = linphone_event_new_with_op(lc, new SalPublishOp(lc->sal), LinphoneSubscriptionInvalidDir, event);
lev->expires = expires;
if (!cfg) cfg = linphone_core_lookup_known_proxy(lc, resource);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL, !!lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL, !!linphone_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
lev->op->setManualRefresherMode(!linphone_config_get_int(lc->config,"sip","refresh_generic_publish",1));
return lev;
}
......
......@@ -165,9 +165,9 @@ static LinphoneCore *_linphone_factory_create_core (
bool_t automatically_start
) {
bctbx_init_logger(FALSE);
LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path);
LpConfig *config = linphone_config_new_with_factory(config_path, factory_config_path);
LinphoneCore *lc = _linphone_core_new_with_config(cbs, config, user_data, system_context, automatically_start);
lp_config_unref(config);
linphone_config_unref(config);
bctbx_uninit_logger();
return lc;
}
......@@ -186,7 +186,7 @@ static LinphoneCore *_linphone_factory_create_shared_core (
bctbx_init_logger(FALSE);
LpConfig *config = linphone_config_new_for_shared_core(app_group_id, config_filename, factory_config_path);
LinphoneCore *lc = _linphone_core_new_shared_with_config(cbs, config, user_data, system_context, automatically_start, app_group_id, main_core);
lp_config_unref(config);
linphone_config_unref(config);
bctbx_uninit_logger();
return lc;
}
......@@ -562,15 +562,15 @@ bool_t linphone_factory_is_imdn_available(LinphoneFactory *factory) {
const char *linphone_factory_get_config_dir(LinphoneFactory *factory, void *context) {
std::string path = LinphonePrivate::Paths::getPath(LinphonePrivate::Paths::Config, context);
return ms_strdup(path.c_str());
return path.c_str();
}
const char *linphone_factory_get_data_dir(LinphoneFactory *factory, void *context) {
std::string path = LinphonePrivate::Paths::getPath(LinphonePrivate::Paths::Data, context);
return ms_strdup(path.c_str());
return path.c_str();
}
const char *linphone_factory_get_download_dir(LinphoneFactory *factory, void *context) {
std::string path = LinphonePrivate::Paths::getPath(LinphonePrivate::Paths::Download, context);
return ms_strdup(path.c_str());
return path.c_str();
}
......@@ -203,7 +203,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
}
fr->outsub=new SalPresenceOp(lc->sal);
linphone_configure_op(lc,fr->outsub,addr,NULL,TRUE);
fr->outsub->subscribe(lp_config_get_int(lc->config,"sip","subscribe_expires",600));
fr->outsub->subscribe(linphone_config_get_int(lc->config,"sip","subscribe_expires",600));
fr->subscribe_active=TRUE;
} else {
ms_error("Can't send a SUBSCRIBE for friend [%p] without an address!", fr);
......@@ -981,7 +981,7 @@ void linphone_core_update_friends_subscriptions(LinphoneCore *lc) {
}
bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc){
return !!lp_config_get_int(lc->config,"sip","subscribe_presence_only_when_registered",1);
return !!linphone_config_get_int(lc->config,"sip","subscribe_presence_only_when_registered",1);
}
void linphone_core_send_initial_subscribes(LinphoneCore *lc) {
......@@ -1129,11 +1129,11 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde
sprintf(item,"friend_%i",index);
if (!lp_config_has_section(config,item)){
if (!linphone_config_has_section(config,item)){
return NULL;
}
tmp=lp_config_get_string(config,item,"url",NULL);
tmp=linphone_config_get_string(config,item,"url",NULL);
if (tmp==NULL) {
return NULL;
}
......@@ -1141,18 +1141,18 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde
if (lf==NULL) {
return NULL;
}
tmp=lp_config_get_string(config,item,"pol",NULL);
tmp=linphone_config_get_string(config,item,"pol",NULL);
if (tmp==NULL) linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPWait);
else{
linphone_friend_set_inc_subscribe_policy(lf,__policy_str_to_enum(tmp));
}
a=lp_config_get_int(config,item,"subscribe",0);
a=linphone_config_get_int(config,item,"subscribe",0);
linphone_friend_send_subscribe(lf,!!a);
a = lp_config_get_int(config, item, "presence_received", 0);
a = linphone_config_get_int(config, item, "presence_received", 0);
lf->presence_received = (bool_t)a;
lf->rc_index = index;
linphone_friend_set_ref_key(lf,lp_config_get_string(config,item,"refkey",NULL));
linphone_friend_set_ref_key(lf,linphone_config_get_string(config,item,"refkey",NULL));
return lf;
}
......@@ -1240,7 +1240,7 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
lc = fr->friend_list->lc;
}
if (lc) {
skip = !lp_config_get_int(fr->lc->config, "misc", "store_friends", 1);
skip = !linphone_config_get_int(fr->lc->config, "misc", "store_friends", 1);
linphone_vcard_set_skip_validation(vcard, skip);
}
linphone_vcard_set_full_name(vcard, name);
......@@ -1542,7 +1542,7 @@ static int linphone_sql_request_generic(sqlite3* db, const char *stmt) {
void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
if (lc && lc->friends_db) {
char *buf;
int store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1);
int store_friends = linphone_config_get_int(lc->config, "misc", "store_friends", 1);
LinphoneVcard *vcard = NULL;
const LinphoneAddress *addr;
char *addr_str = NULL;
......@@ -1604,7 +1604,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList *list) {
if (lc && lc->friends_db) {
char *buf;
int store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1);
int store_friends = linphone_config_get_int(lc->config, "misc", "store_friends", 1);
if (!store_friends) {
return;
......
......@@ -505,7 +505,7 @@ LinphoneFriendList * linphone_core_create_friend_list(LinphoneCore *lc) {
list->lc = lc;
if (lc) { // Will be NULL if created from database
// We can't use linphone_core_is_friend_list_subscription_enabled because this will be called before the C++ core is initialized
list->enable_subscriptions = !!lp_config_get_int(linphone_core_get_config(lc), "net", "friendlist_subscription_enabled", 1);
list->enable_subscriptions = !!linphone_config_get_int(linphone_core_get_config(lc), "net", "friendlist_subscription_enabled", 1);
}
return list;
}
......@@ -569,7 +569,7 @@ const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFrie
if (list->rls_addr)
return list->rls_addr;
else if (list->lc) {
const char* rls_uri = lp_config_get_string(list->lc->config, "sip", "rls_uri", NULL);
const char* rls_uri = linphone_config_get_string(list->lc->config, "sip", "rls_uri", NULL);
if (list->lc->default_rls_addr)
linphone_address_unref(list->lc->default_rls_addr);
......@@ -1000,7 +1000,7 @@ static void _linphone_friend_list_send_list_subscription_with_body(LinphoneFrien
} else {
LinphoneContent *content;
bctbx_list_t * elem = NULL;
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
int expires = linphone_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
list->expected_notification_version = 0;
if (list->content_digest)
ms_free(list->content_digest);
......@@ -1039,7 +1039,7 @@ static void _linphone_friend_list_send_list_subscription_with_body(LinphoneFrien
static void _linphone_friend_list_send_list_subscription_without_body(LinphoneFriendList *list, const LinphoneAddress *address) {
bctbx_list_t *elem = NULL;
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
int expires = linphone_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
list->expected_notification_version = 0;
if (list->content_digest)
ms_free(list->content_digest);
......
......@@ -36,7 +36,7 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneImNotifPolicy, belle_sip_object_t,
static void load_im_notif_policy_from_config(LinphoneImNotifPolicy *policy) {
#ifdef HAVE_ADVANCED_IM
bctbx_list_t *default_list = bctbx_list_append(NULL, (void *)"all");
bctbx_list_t *values = lp_config_get_string_list(policy->lc->config, "sip", "im_notif_policy", default_list);
bctbx_list_t *values = linphone_config_get_string_list(policy->lc->config, "sip", "im_notif_policy", default_list);
bctbx_list_t *elem;
for (elem = values; elem != NULL; elem = bctbx_list_next(elem)) {
......@@ -114,7 +114,7 @@ static void save_im_notif_policy_to_config(LinphoneImNotifPolicy *policy) {
if (policy->recv_imdn_displayed == TRUE)
values = bctbx_list_append(values, (void *)"recv_imdn_displayed");
}
lp_config_set_string_list(policy->lc->config, "sip", "im_notif_policy", values);
linphone_config_set_string_list(policy->lc->config, "sip", "im_notif_policy", values);
if (values != NULL) bctbx_list_free(values);
#endif
}
......
......@@ -793,7 +793,7 @@ int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEn
);
retval = lime_decryptMultipartMessage(zrtp_cache_db, (uint8_t *)linphone_chat_message_get_text(msg), selfUri, peerUri, &decrypted_body, &decrypted_content_type,
bctbx_time_string_to_sec(lp_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
bctbx_time_string_to_sec(linphone_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
ms_free(peerUri);
ms_free(selfUri);
if (retval != 0) {
......
......@@ -228,7 +228,7 @@ static void linphone_tunnel_save_config(const LinphoneTunnel *tunnel) {
}
}
}
lp_config_set_string(config(tunnel), "tunnel", "server_addresses", tmp);
linphone_config_set_string(config(tunnel), "tunnel", "server_addresses", tmp);
if(tmp != NULL) {
ms_free(tmp);
}
......@@ -264,7 +264,7 @@ static void linphone_tunnel_add_server_intern(LinphoneTunnel *tunnel, LinphoneTu
static void linphone_tunnel_load_config(LinphoneTunnel *tunnel){
const char * confaddress = lp_config_get_string(config(tunnel), "tunnel", "server_addresses", NULL);
const char * confaddress = linphone_config_get_string(config(tunnel), "tunnel", "server_addresses", NULL);
char *tmp;
const char *it;
LinphoneTunnelConfig *tunnel_config;
......@@ -330,7 +330,7 @@ void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){
}
void linphone_tunnel_set_mode(LinphoneTunnel *tunnel, LinphoneTunnelMode mode){
lp_config_set_string(config(tunnel),"tunnel","mode", linphone_tunnel_mode_to_string(mode));
linphone_config_set_string(config(tunnel),"tunnel","mode", linphone_tunnel_mode_to_string(mode));
bcTunnel(tunnel)->setMode(mode);
}
......@@ -339,7 +339,7 @@ LinphoneTunnelMode linphone_tunnel_get_mode(const LinphoneTunnel *tunnel){
}
void linphone_tunnel_enable_dual_mode(LinphoneTunnel *tunnel, bool_t dual_mode_enabled) {
lp_config_set_int(config(tunnel), "tunnel", "dual_mode", (dual_mode_enabled ? TRUE : FALSE));
linphone_config_set_int(config(tunnel), "tunnel", "dual_mode", (dual_mode_enabled ? TRUE : FALSE));
bcTunnel(tunnel)->enableDualMode(dual_mode_enabled);
}
......@@ -361,17 +361,17 @@ void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel *tunnel, const char
void linphone_tunnel_set_http_proxy(LinphoneTunnel*tunnel, const char *host, int port, const char* username,const char* passwd){
bcTunnel(tunnel)->setHttpProxy(host, port, username, passwd);
lp_config_set_string(config(tunnel),"tunnel","http_proxy_host",host);
lp_config_set_int(config(tunnel),"tunnel","http_proxy_port",port);
lp_config_set_string(config(tunnel),"tunnel","http_proxy_username",username);
lp_config_set_string(config(tunnel),"tunnel","http_proxy_password",passwd);
linphone_config_set_string(config(tunnel),"tunnel","http_proxy_host",host);
linphone_config_set_int(config(tunnel),"tunnel","http_proxy_port",port);
linphone_config_set_string(config(tunnel),"tunnel","http_proxy_username",username);
linphone_config_set_string(config(tunnel),"tunnel","http_proxy_password",passwd);
}
void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int *port, const char **username, const char **passwd){
if (host) *host=lp_config_get_string(config(tunnel),"tunnel","http_proxy_host",NULL);
if (port) *port=lp_config_get_int(config(tunnel),"tunnel","http_proxy_port",0);
if (username) *username=lp_config_get_string(config(tunnel),"tunnel","http_proxy_username",NULL);
if (passwd) *passwd=lp_config_get_string(config(tunnel),"tunnel","http_proxy_password",NULL);
if (host) *host=linphone_config_get_string(config(tunnel),"tunnel","http_proxy_host",NULL);
if (port) *port=linphone_config_get_int(config(tunnel),"tunnel","http_proxy_port",0);
if (username) *username=linphone_config_get_string(config(tunnel),"tunnel","http_proxy_username",NULL);
if (passwd) *passwd=linphone_config_get_string(config(tunnel),"tunnel","http_proxy_password",NULL);
}
void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){
......@@ -380,7 +380,7 @@ void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){
void linphone_tunnel_enable_sip(LinphoneTunnel *tunnel, bool_t enable) {
bcTunnel(tunnel)->tunnelizeSipPackets(enable == FALSE ? false : true);
lp_config_set_int(config(tunnel), "tunnel", "sip", (enable ? TRUE : FALSE));
linphone_config_set_int(config(tunnel), "tunnel", "sip", (enable ? TRUE : FALSE));
}
bool_t linphone_tunnel_sip_enabled(const LinphoneTunnel *tunnel) {
......@@ -389,7 +389,7 @@ bool_t linphone_tunnel_sip_enabled(const LinphoneTunnel *tunnel) {
void linphone_tunnel_verify_server_certificate(LinphoneTunnel *tunnel, bool_t enable) {
bcTunnel(tunnel)->verifyServerCertificate(enable == FALSE ? false : true);
lp_config_set_int(config(tunnel), "tunnel", "verify_cert", (enable ? TRUE : FALSE));
linphone_config_set_int(config(tunnel), "tunnel", "verify_cert", (enable ? TRUE : FALSE));
}
bool_t linphone_tunnel_verify_server_certificate_enabled(const LinphoneTunnel *tunnel) {
......@@ -402,12 +402,12 @@ bool_t linphone_tunnel_verify_server_certificate_enabled(const LinphoneTunnel *t
* Called internally from linphonecore at startup.
*/
void linphone_tunnel_configure(LinphoneTunnel *tunnel){
LinphoneTunnelMode mode = linphone_tunnel_mode_from_string(lp_config_get_string(config(tunnel), "tunnel", "mode", NULL));
bool_t tunnelizeSIPPackets = (bool_t)lp_config_get_int(config(tunnel), "tunnel", "sip", TRUE);
bool_t tunnelVerifyServerCertificate = (bool_t)lp_config_get_int(config(tunnel), "tunnel", "verify_cert", FALSE);
bool_t useDualMode = (bool_t)lp_config_get_int(config(tunnel), "tunnel", "dual_mode", FALSE);
const char *username = lp_config_get_string(config(tunnel), "tunnel", "username", NULL);
const char *domain = lp_config_get_string(config(tunnel), "tunnel", "domain", NULL);
LinphoneTunnelMode mode = linphone_tunnel_mode_from_string(linphone_config_get_string(config(tunnel), "tunnel", "mode", NULL));
bool_t tunnelizeSIPPackets = (bool_t)linphone_config_get_int(config(tunnel), "tunnel", "sip", TRUE);
bool_t tunnelVerifyServerCertificate = (bool_t)linphone_config_get_int(config(tunnel), "tunnel", "verify_cert", FALSE);
bool_t useDualMode = (bool_t)linphone_config_get_int(config(tunnel), "tunnel", "dual_mode", FALSE);
const char *username = linphone_config_get_string(config(tunnel), "tunnel", "username", NULL);
const char *domain = linphone_config_get_string(config(tunnel), "tunnel", "domain", NULL);
const char *http_host, *http_username, *http_passwd;
int http_port;
linphone_tunnel_get_http_proxy(tunnel,&http_host, &http_port, &http_username, &http_passwd);
......@@ -447,20 +447,20 @@ bool_t linphone_tunnel_auto_detect_enabled(LinphoneTunnel *tunnel) {
void linphone_tunnel_set_username(LinphoneTunnel *tunnel, const char *username) {
bcTunnel(tunnel)->setUsername(username);
lp_config_set_string(config(tunnel), "tunnel", "username", username);
linphone_config_set_string(config(tunnel), "tunnel", "username", username);
}
const char *linphone_tunnel_get_username(LinphoneTunnel *tunnel) {
return lp_config_get_string(config(tunnel), "tunnel", "username", NULL);
return linphone_config_get_string(config(tunnel), "tunnel", "username", NULL);
}
void linphone_tunnel_set_domain(LinphoneTunnel *tunnel, const char *domain) {
bcTunnel(tunnel)->setDomain(domain);