Commit 2d533416 authored by Matthieu Tanon's avatar Matthieu Tanon
Browse files

First corrections based on merge review

parent 5bf36458
......@@ -866,7 +866,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_create_account_linphone(Li
return LinphoneAccountCreatorStatusRequestFailed;
}
static void _delete_account_cb_custom(LinphoneXmlRpcRequest *request) {
static void _delete_linphone_account_response_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->cbs->delete_account_response_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorStatusRequestFailed;
......@@ -883,7 +883,6 @@ static void _delete_account_cb_custom(LinphoneXmlRpcRequest *request) {
}
LinphoneAccountCreatorStatus linphone_account_creator_delete_account_linphone(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
if ((!creator->username && !creator->phone_number) || !creator->password) {
return LinphoneAccountCreatorStatusMissingArguments;
}
......@@ -893,12 +892,12 @@ LinphoneAccountCreatorStatus linphone_account_creator_delete_account_linphone(Li
creator->password,
linphone_proxy_config_get_domain(creator->proxy_cfg));
request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "delete_account");
LinphoneXmlRpcRequest *request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "delete_account");
linphone_xml_rpc_request_add_string_arg(request, creator->username ? creator->username : creator->phone_number);
linphone_xml_rpc_request_add_string_arg(request, creator->password);
linphone_xml_rpc_request_add_string_arg(request, linphone_proxy_config_get_domain(creator->proxy_cfg));
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _delete_account_cb_custom);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _delete_linphone_account_response_cb);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
......@@ -986,7 +985,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_email_account_lin
return LinphoneAccountCreatorStatusRequestFailed;
}
static void _get_confirmation_key_cb_custom(LinphoneXmlRpcRequest *request) {
static void get_linphone_confirmation_key_response_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->cbs->get_confirmation_key_response_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorStatusRequestFailed;
......@@ -1002,15 +1001,12 @@ static void _get_confirmation_key_cb_custom(LinphoneXmlRpcRequest *request) {
status = LinphoneAccountCreatorStatusRequestOk;
set_string(&creator->activation_code, resp, FALSE);
}
} else {
}
creator->cbs->get_confirmation_key_response_cb(creator, status, resp);
} else {
}
}
LinphoneAccountCreatorStatus linphone_account_creator_get_confirmation_key_linphone(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
if (!creator->username || !creator->password) {
if (creator->cbs->get_confirmation_key_response_cb != NULL) {
creator->cbs->get_confirmation_key_response_cb(creator, LinphoneAccountCreatorStatusMissingArguments, "Missing required parameters");
......@@ -1023,13 +1019,13 @@ LinphoneAccountCreatorStatus linphone_account_creator_get_confirmation_key_linph
creator->password,
linphone_proxy_config_get_domain(creator->proxy_cfg));
request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "get_confirmation_key");
LinphoneXmlRpcRequest *request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "get_confirmation_key");
linphone_xml_rpc_request_add_string_arg(request, creator->username);
linphone_xml_rpc_request_add_string_arg(request, ha1_for_passwd(creator->username, linphone_proxy_config_get_domain(creator->proxy_cfg), creator->password, creator->algorithm));
linphone_xml_rpc_request_add_string_arg(request, linphone_proxy_config_get_domain(creator->proxy_cfg));
linphone_xml_rpc_request_add_string_arg(request, creator->algorithm);
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _get_confirmation_key_cb_custom);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), get_linphone_confirmation_key_response_cb);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
return LinphoneAccountCreatorStatusRequestOk;
......@@ -1339,7 +1335,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_update_password_linphone(L
if (creator->xmlrpc_session) {
const char *username = creator->username ? creator->username : creator->phone_number;
char *ha1 = bctbx_strdup(creator->ha1 ? creator->ha1 : ha1_for_passwd(username, _get_domain(creator), creator->password, creator->algorithm) );
char *ha1 = bctbx_strdup(creator->ha1 ? creator->ha1 : ha1_for_passwd(username, _get_domain(creator), creator->password, creator->algorithm));
char *new_ha1 = bctbx_strdup(ha1_for_passwd(username, _get_domain(creator), new_pwd, creator->algorithm));
ms_debug("Account creator: update_password (username=%s, domain=%s)",
......
......@@ -93,8 +93,8 @@ static void call_received(SalCallOp *h) {
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
const char *oneToOneChatRoomStr = sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room");
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0)) {
string oneToOneChatRoom = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room"));
if (oneToOneChatRoom == "true") {
bool_t oneToOneChatRoomEnabled = linphone_config_get_bool(linphone_core_get_config(lc), "misc", "enable_one_to_one_chat_room", TRUE);
if (!oneToOneChatRoomEnabled) {
h->decline(SalReasonNotAcceptable);
......@@ -108,10 +108,8 @@ static void call_received(SalCallOp *h) {
h->release();
return;
}
bool encrypted = false;
const char *endToEndEncryptedStr = sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted");
if (endToEndEncryptedStr && (strcmp(endToEndEncryptedStr, "true") == 0))
encrypted = true;
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted"));
bool encrypted = (endToEndEncrypted == "true");
IdentityAddress confAddr = L_GET_PRIVATE_FROM_C_OBJECT(lc)->mainDb->findOneToOneConferenceChatRoomAddress(from, identAddresses.front(), encrypted);
if (confAddr.isValid()) {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ConferenceId(confAddr, confAddr));
......@@ -147,11 +145,8 @@ static void call_received(SalCallOp *h) {
chatRoom.reset();
}
if (!chatRoom) {
bool encrypted = false;
const char *endToEndEncryptedStr = sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted");
if (endToEndEncryptedStr && (strcmp(endToEndEncryptedStr, "true") == 0)) {
encrypted = true;
}
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted"));
bool encrypted = (endToEndEncrypted == "true");
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
h->getSubject(), h->getRemoteContact(), h->getRemoteBody(), false, encrypted
);
......@@ -858,7 +853,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
ConferenceId(addr, IdentityAddress(op->getTo()))
);
if (!chatRoom) {
bool encrypted = false; // TODO get encryption information from INVITE
bool encrypted = false;
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom("", addr.asString(), Content(), false, encrypted);
}
chatRoom->join();
......
......@@ -147,7 +147,7 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room_2 (
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)),
encrypted)
!!encrypted)
);
}
......
......@@ -866,12 +866,12 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
#endif
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
LinphoneFriendList *fl = linphone_core_get_default_friend_list(lc);
if (fl == NULL) {
fl = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, fl);
LinphoneFriendList *friendList = linphone_core_get_default_friend_list(lc);
if (!friendList) {
friendList = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, friendList);
}
if (linphone_friend_list_add_friend(fl, lf) != LinphoneFriendListOK) return;
if (linphone_friend_list_add_friend(friendList, lf) != LinphoneFriendListOK) return;
if (bctbx_list_find(lc->subscribers, lf)) {
/*if this friend was in the pending subscriber list, now remove it from this list*/
lc->subscribers = bctbx_list_remove(lc->subscribers, lf);
......
......@@ -1343,11 +1343,13 @@ static void bodyless_config_read(LinphoneCore *lc) {
bctbx_list_t *bodyless_lists = linphone_config_get_string_list(lc->config, "sip", "bodyless_lists", NULL);
while (bodyless_lists) {
char *name = (char *)bodyless_lists->data;
bodyless_lists = bodyless_lists->next;
char *name = (char *)bctbx_list_get_data(bodyless_lists);
bodyless_lists = bctbx_list_next(bodyless_lists);
LinphoneAddress *addr = linphone_address_new(name);
if(!addr)
if(!addr) {
bctbx_free(name);
continue;
}
ms_message("Found bodyless friendlist %s", name);
bctbx_free(name);
......@@ -2756,12 +2758,11 @@ void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list
}
void linphone_core_clear_bodyless_friend_lists(LinphoneCore *lc) {
bctbx_list_t* list = bctbx_list_copy(linphone_core_get_friends_lists((const LinphoneCore *)lc));
bctbx_list_t* copy = list;
for (; list != NULL; list = list->next) {
LinphoneFriendList *friends = (LinphoneFriendList *)list->data;
bctbx_list_t *copy = bctbx_list_copy(linphone_core_get_friends_lists((const LinphoneCore *)lc));
for (auto it = copy; it; it = bctbx_list_next(it)) {
LinphoneFriendList *friends = (LinphoneFriendList *)bctbx_list_get_data(copy);
if (linphone_friend_list_is_subscription_bodyless(friends))
linphone_core_remove_friend_list(lc, (LinphoneFriendList *)list->data);
linphone_core_remove_friend_list(lc, (LinphoneFriendList *)bctbx_list_get_data(copy));
}
bctbx_list_free(copy);
}
......
......@@ -242,20 +242,20 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *cfg){
}
void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg){
if (cfg->reg_proxy!=NULL) ms_free(cfg->reg_proxy);
if (cfg->reg_identity!=NULL) ms_free(cfg->reg_identity);
if (cfg->identity_address!=NULL) linphone_address_unref(cfg->identity_address);
if (cfg->reg_routes!=NULL) bctbx_list_free_with_data(cfg->reg_routes, ms_free);
if (cfg->quality_reporting_collector!=NULL) ms_free(cfg->quality_reporting_collector);
if (cfg->ssctx!=NULL) sip_setup_context_free(cfg->ssctx);
if (cfg->realm!=NULL) ms_free(cfg->realm);
if (cfg->type!=NULL) ms_free(cfg->type);
if (cfg->dial_prefix!=NULL) ms_free(cfg->dial_prefix);
if (cfg->reg_proxy != NULL) ms_free(cfg->reg_proxy);
if (cfg->reg_identity != NULL) ms_free(cfg->reg_identity);
if (cfg->identity_address != NULL) linphone_address_unref(cfg->identity_address);
if (cfg->reg_routes != NULL) bctbx_list_free_with_data(cfg->reg_routes, ms_free);
if (cfg->quality_reporting_collector != NULL) ms_free(cfg->quality_reporting_collector);
if (cfg->ssctx != NULL) sip_setup_context_free(cfg->ssctx);
if (cfg->realm != NULL) ms_free(cfg->realm);
if (cfg->type != NULL) ms_free(cfg->type);
if (cfg->dial_prefix != NULL) ms_free(cfg->dial_prefix);
if (cfg->contact_params) ms_free(cfg->contact_params);
if (cfg->contact_uri_params) ms_free(cfg->contact_uri_params);
if (cfg->saved_proxy!=NULL) linphone_address_unref(cfg->saved_proxy);
if (cfg->saved_identity!=NULL) linphone_address_unref(cfg->saved_identity);
if (cfg->sent_headers!=NULL) sal_custom_header_free(cfg->sent_headers);
if (cfg->saved_proxy != NULL) linphone_address_unref(cfg->saved_proxy);
if (cfg->saved_identity != NULL) linphone_address_unref(cfg->saved_identity);
if (cfg->sent_headers != NULL) sal_custom_header_free(cfg->sent_headers);
if (cfg->pending_contact) linphone_address_unref(cfg->pending_contact);
if (cfg->refkey) ms_free(cfg->refkey);
if (cfg->nat_policy != NULL) {
......@@ -1160,52 +1160,52 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
{
char key[50];
sprintf(key,"proxy_%i",index);
lp_config_clean_section(config,key);
if (cfg==NULL){
sprintf(key, "proxy_%i", index);
lp_config_clean_section(config, key);
if (cfg == NULL){
return;
}
if (cfg->type!=NULL){
lp_config_set_string(config,key,"type",cfg->type);
if (cfg->type != NULL){
lp_config_set_string(config, key, "type", cfg->type);
}
if (cfg->reg_proxy!=NULL){
lp_config_set_string(config,key,"reg_proxy",cfg->reg_proxy);
if (cfg->reg_proxy != NULL){
lp_config_set_string(config, key, "reg_proxy", cfg->reg_proxy);
}
if (cfg->reg_routes != NULL) {
lp_config_set_string_list(config, key, "reg_route", cfg->reg_routes);
}
if (cfg->reg_identity!=NULL){
lp_config_set_string(config,key,"reg_identity",cfg->reg_identity);
if (cfg->reg_identity != NULL){
lp_config_set_string(config, key, "reg_identity", cfg->reg_identity);
}
if (cfg->realm!=NULL){
lp_config_set_string(config,key,"realm",cfg->realm);
if (cfg->realm != NULL){
lp_config_set_string(config, key, "realm", cfg->realm);
}
if (cfg->contact_params!=NULL){
lp_config_set_string(config,key,"contact_parameters",cfg->contact_params);
if (cfg->contact_params != NULL){
lp_config_set_string(config, key, "contact_parameters", cfg->contact_params);
}
if (cfg->contact_uri_params!=NULL){
lp_config_set_string(config,key,"contact_uri_parameters",cfg->contact_uri_params);
if (cfg->contact_uri_params != NULL){
lp_config_set_string(config, key, "contact_uri_parameters", cfg->contact_uri_params);
}
if (cfg->quality_reporting_collector!=NULL){
lp_config_set_string(config,key,"quality_reporting_collector",cfg->quality_reporting_collector);
if (cfg->quality_reporting_collector != NULL){
lp_config_set_string(config, key, "quality_reporting_collector", cfg->quality_reporting_collector);
}
lp_config_set_int(config,key,"quality_reporting_enabled",cfg->quality_reporting_enabled);
lp_config_set_int(config,key,"quality_reporting_interval",cfg->quality_reporting_interval);
lp_config_set_int(config,key,"reg_expires",cfg->expires);
lp_config_set_int(config,key,"reg_sendregister",cfg->reg_sendregister);
lp_config_set_int(config,key,"publish",cfg->publish);
lp_config_set_int(config,key,"avpf",cfg->avpf_mode);
lp_config_set_int(config,key,"avpf_rr_interval",cfg->avpf_rr_interval);
lp_config_set_int(config,key,"dial_escape_plus",cfg->dial_escape_plus);
lp_config_set_string(config,key,"dial_prefix",cfg->dial_prefix);
lp_config_set_int(config,key,"privacy",(int)cfg->privacy);
lp_config_set_int(config,key,"push_notification_allowed",(int)cfg->push_notification_allowed);
if (cfg->refkey) lp_config_set_string(config,key,"refkey",cfg->refkey);
lp_config_set_int(config,key,"publish_expires",cfg->publish_expires);
lp_config_set_int(config,key,"lime_x3dh",cfg->lime_x3dh);
lp_config_set_int(config, key, "quality_reporting_enabled", cfg->quality_reporting_enabled);
lp_config_set_int(config, key, "quality_reporting_interval", cfg->quality_reporting_interval);
lp_config_set_int(config, key, "reg_expires", cfg->expires);
lp_config_set_int(config, key, "reg_sendregister", cfg->reg_sendregister);
lp_config_set_int(config, key, "publish", cfg->publish);
lp_config_set_int(config, key, "avpf", cfg->avpf_mode);
lp_config_set_int(config, key, "avpf_rr_interval", cfg->avpf_rr_interval);
lp_config_set_int(config, key, "dial_escape_plus", cfg->dial_escape_plus);
lp_config_set_string(config,key,"dial_prefix", cfg->dial_prefix);
lp_config_set_int(config, key, "privacy", (int)cfg->privacy);
lp_config_set_int(config, key, "push_notification_allowed", (int)cfg->push_notification_allowed);
if (cfg->refkey) lp_config_set_string(config, key, "refkey", cfg->refkey);
lp_config_set_int(config, key, "publish_expires", cfg->publish_expires);
lp_config_set_int(config, key, "lime_x3dh", cfg->lime_x3dh);
if (cfg->nat_policy != NULL) {
lp_config_set_string(config,key,"nat_policy_ref",cfg->nat_policy->ref);
lp_config_set_string(config, key, "nat_policy_ref", cfg->nat_policy->ref);
linphone_nat_policy_save_to_config(cfg->nat_policy);
}
......@@ -1242,39 +1242,39 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
cfg=linphone_core_create_proxy_config(lc);
CONFIGURE_STRING_VALUE(cfg,config,key,identity,"reg_identity")
CONFIGURE_STRING_VALUE(cfg,config,key,server_addr,"reg_proxy")
CONFIGURE_STRING_VALUE(cfg, config, key, identity, "reg_identity")
CONFIGURE_STRING_VALUE(cfg, config, key, server_addr, "reg_proxy")
bctbx_list_t *routes = linphone_config_get_string_list(config, key, "reg_route", NULL);
linphone_proxy_config_set_routes(cfg, routes);
if (routes)
bctbx_list_free_with_data(routes, (bctbx_list_free_func)bctbx_free);
CONFIGURE_STRING_VALUE(cfg,config,key,realm,"realm")
CONFIGURE_STRING_VALUE(cfg, config, key, realm, "realm")
CONFIGURE_BOOL_VALUE(cfg,config,key,quality_reporting,"quality_reporting_enabled")
CONFIGURE_STRING_VALUE(cfg,config,key,quality_reporting_collector,"quality_reporting_collector")
CONFIGURE_INT_VALUE(cfg,config,key,quality_reporting_interval,"quality_reporting_interval",int)
CONFIGURE_BOOL_VALUE(cfg, config, key, quality_reporting, "quality_reporting_enabled")
CONFIGURE_STRING_VALUE(cfg, config, key, quality_reporting_collector, "quality_reporting_collector")
CONFIGURE_INT_VALUE(cfg, config, key, quality_reporting_interval, "quality_reporting_interval", int)
CONFIGURE_STRING_VALUE(cfg,config,key,contact_parameters,"contact_parameters")
CONFIGURE_STRING_VALUE(cfg,config,key,contact_uri_parameters,"contact_uri_parameters")
CONFIGURE_STRING_VALUE(cfg, config, key, contact_parameters, "contact_parameters")
CONFIGURE_STRING_VALUE(cfg, config, key, contact_uri_parameters, "contact_uri_parameters")
CONFIGURE_INT_VALUE(cfg,config,key,expires,"reg_expires", int)
CONFIGURE_BOOL_VALUE(cfg,config,key,register,"reg_sendregister")
CONFIGURE_BOOL_VALUE(cfg,config,key,publish,"publish")
linphone_proxy_config_set_push_notification_allowed(cfg, !!lp_config_get_int(config,key,"push_notification_allowed",linphone_proxy_config_is_push_notification_allowed(cfg)));
linphone_proxy_config_set_avpf_mode(cfg,static_cast<LinphoneAVPFMode>(lp_config_get_int(config,key,"avpf",linphone_proxy_config_get_avpf_mode(cfg))));
CONFIGURE_INT_VALUE(cfg,config,key,avpf_rr_interval,"avpf_rr_interval",uint8_t)
CONFIGURE_INT_VALUE(cfg,config,key,dial_escape_plus,"dial_escape_plus",bool_t)
CONFIGURE_STRING_VALUE(cfg,config,key,dial_prefix,"dial_prefix")
CONFIGURE_INT_VALUE(cfg,config, key, expires, "reg_expires", int)
CONFIGURE_BOOL_VALUE(cfg, config, key, register, "reg_sendregister")
CONFIGURE_BOOL_VALUE(cfg, config, key, publish, "publish")
linphone_proxy_config_set_push_notification_allowed(cfg, !!lp_config_get_int(config, key, "push_notification_allowed", linphone_proxy_config_is_push_notification_allowed(cfg)));
linphone_proxy_config_set_avpf_mode(cfg, static_cast<LinphoneAVPFMode>(lp_config_get_int(config, key, "avpf", linphone_proxy_config_get_avpf_mode(cfg))));
CONFIGURE_INT_VALUE(cfg, config, key, avpf_rr_interval, "avpf_rr_interval", uint8_t)
CONFIGURE_INT_VALUE(cfg, config,key, dial_escape_plus, "dial_escape_plus", bool_t)
CONFIGURE_STRING_VALUE(cfg, config, key, dial_prefix, "dial_prefix")
tmp=lp_config_get_string(config,key,"type",NULL);
if (tmp!=NULL && strlen(tmp)>0)
linphone_proxy_config_set_sip_setup(cfg,tmp);
CONFIGURE_INT_VALUE(cfg,config,key,privacy,"privacy",LinphonePrivacyMask)
tmp = lp_config_get_string(config, key, "type", NULL);
if (tmp != NULL && strlen(tmp) > 0)
linphone_proxy_config_set_sip_setup(cfg, tmp);
CONFIGURE_INT_VALUE(cfg, config, key, privacy, "privacy", LinphonePrivacyMask)
CONFIGURE_STRING_VALUE(cfg,config,key,ref_key,"refkey")
CONFIGURE_INT_VALUE(cfg,config,key,publish_expires,"publish_expires",int)
CONFIGURE_BOOL_VALUE(cfg,config,key,lime_x3dh,"lime_v2")
CONFIGURE_STRING_VALUE(cfg, config, key, ref_key, "refkey")
CONFIGURE_INT_VALUE(cfg, config, key, publish_expires, "publish_expires", int)
CONFIGURE_BOOL_VALUE(cfg, config, key, lime_x3dh, "lime_v2")
nat_policy_ref = lp_config_get_string(config, key, "nat_policy_ref", NULL);
if (nat_policy_ref != NULL) {
......
......@@ -184,13 +184,11 @@ static void process_auth_requested_from_post_xml_rpc_request(void *data, belle_s
LinphoneXmlRpcRequest *request = (LinphoneXmlRpcRequest *)data;
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
LinphoneCore *lc = creator->core;
const char *realm = belle_sip_auth_event_get_realm(event);
const char *username = belle_sip_auth_event_get_username(event);
const char *domain = belle_sip_auth_event_get_domain(event);
const LinphoneAuthInfo *auth_info = linphone_core_find_auth_info(lc, realm, username, domain);
const LinphoneAuthInfo *auth_info = linphone_core_find_auth_info(creator->core, realm, username, domain);
if (auth_info) {
const char *auth_username = linphone_auth_info_get_username(auth_info);
......
......@@ -260,9 +260,9 @@ LINPHONE_PUBLIC const char * linphone_account_creator_get_activation_code(const
LINPHONE_PUBLIC LinphoneAccountCreatorLanguageStatus linphone_account_creator_set_language(LinphoneAccountCreator *creator, const char *lang);
/**
* Set the algorithm supported.
* Set the supported algorithm.
* @param[in] creator LinphoneAccountCreator object
* @param[in] lang The algorithm to use
* @param[in] algorithm The algorithm to use
* @return LinphoneAccountCreatorAlgoStatusOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorAlgoStatus linphone_account_creator_set_algorithm(LinphoneAccountCreator *creator, const char *algorithm);
......
......@@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsSecurityEventCb linphone_chat_room_cbs_get_se
/**
* Set the security event callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @param[in] cb The current security event callback to be used.
* @param[in] cb The security event callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_security_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSecurityEventCb cb);
......
......@@ -1538,20 +1538,13 @@ LINPHONE_PUBLIC bool_t linphone_core_lime_available(const LinphoneCore *lc);
/**
* Tells to LinphoneCore to use LIME X3DH
* @param[in] lc LinphoneCore object
* @param[in] val The new lime state
* @param[in] enable A boolean value telling whether to enable or disable LIME X3DH
* @ingroup network_parameters
*/
LINPHONE_PUBLIC void linphone_core_enable_lime_x3dh(LinphoneCore *lc, bool_t enable);
/**
* Tells to LinphoneCore to update LIME X3DH
* @param[in] lc LinphoneCore object
* @ingroup network_parameters
*/
LINPHONE_PUBLIC void linphone_core_update_lime_x3dh(const LinphoneCore *lc);
/**
* Returns the LIME X3DH state
* Tells wether LIME X3DH is enabled or not
* @param[in] lc LinphoneCore object
* @return The current lime state
* @ingroup network_parameters
......
......@@ -26,7 +26,7 @@
F(None /**< Event is not a security event */) \
F(SecurityLevelDowngraded /**< Chatroom security level downgraded event */) \
F(ParticipantMaxDeviceCountExceeded /**< Participant has exceeded the maximum number of device event */) \
F(LimeIdentityKeyChanged /**< Peer device lime identity key has changed event */) \
F(EncryptionIdentityKeyChanged /**< Peer device instant messaging encryption identity key has changed event */) \
F(ManInTheMiddleDetected /**< Man in the middle detected event */) \
#endif // ifndef _L_SECURITY_EVENT_ENUMS_H_
......@@ -372,7 +372,7 @@ LINPHONE_PUBLIC bool_t linphone_proxy_config_lime_x3dh_enabled(const LinphonePro
/**
* @param[in] cfg #LinphoneProxyConfig object.
* @param val if TRUE LIME X3DH will be enabled for this user
* @param val if TRUE LIME X3DH will be enabled for this proxy config
**/
LINPHONE_PUBLIC void linphone_proxy_config_enable_lime_x3dh(LinphoneProxyConfig *cfg, const bool_t val);
......
......@@ -65,21 +65,12 @@ void linphone_core_set_im_encryption_engine (LinphoneCore *lc, LinphoneImEncrypt
}
void linphone_core_enable_lime_x3dh (LinphoneCore *lc, bool_t enable) {
// if (L_GET_CPP_PTR_FROM_C_OBJECT(lc)->limeX3dhAvailable()) {
// cout << "LIMEv2 is available, enabling" << endl;
// } else {
// cout << "LIMEv2 is unavailable, not enabling" << endl;
// }
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->enableLimeX3dh(enable);
}
void linphone_core_update_lime_x3dh (const LinphoneCore *lc) {
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->updateLimeX3dh();
}
bool_t linphone_core_lime_x3dh_enabled (const LinphoneCore *lc) {
bool isEnabled = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->limeX3dhEnabled();
return isEnabled?TRUE:FALSE;
return isEnabled ? TRUE : FALSE;
}
bool_t linphone_core_lime_x3dh_available (const LinphoneCore *lc) {
......@@ -90,6 +81,6 @@ void linphone_core_delete_local_lime_x3dh_db (const LinphoneCore *lc) {
if (L_GET_CPP_PTR_FROM_C_OBJECT(lc)->limeX3dhEnabled()) {
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getEncryptionEngine()->cleanDb();
} else {
lWarning() << "Trying to clean local LIMEv2 databases but LIMEv2 is disabled";
lWarning() << "Trying to clean local LIME X3DH databases but LIME X3DH is disabled";
}
}
......@@ -168,15 +168,7 @@ static bool isConferenceSubjectType (LinphoneEventLogType type) {
}
static bool isConferenceSecurityType (LinphoneEventLogType type) {
switch (type) {
case LinphoneEventLogTypeConferenceSecurityEvent:
return true;
default:
break;
}
return false;
return (type == LinphoneEventLogTypeConferenceSecurityEvent);
}
// -----------------------------------------------------------------------------
......@@ -328,8 +320,7 @@ LINPHONE_PUBLIC LinphoneSecurityEventType linphone_event_log_get_security_event_
const auto securityEvent = static_pointer_cast<const LinphonePrivate::ConferenceSecurityEvent>(
L_GET_CPP_PTR_FROM_C_OBJECT(event_log)
);
LinphoneSecurityEventType eventType = static_cast<LinphoneSecurityEventType>(securityEvent->getSecurityEventType());
return eventType;
return static_cast<LinphoneSecurityEventType>(securityEvent->getSecurityEventType());
}
LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_event_faulty_device_address (const LinphoneEventLog *event_log) {
......
......@@ -560,7 +560,7 @@ LinphoneReason ChatMessagePrivate::receive () {
// Message Authorization
if (getAuthorizationWarning()) {
lWarning() << "Message authorization warning raised by LIMEv2";
lWarning() << "Message authorization warning raised by encryption engine";
// Allow error IMDN exclusively
if (q->getSharedFromThis()->getInternalContent().getContentType() != ContentType::Imdn && !Imdn::isError(q->getSharedFromThis())) {
......
......@@ -78,7 +78,7 @@ public:
}
migrationRealTime = currentRealTime;
clientGroupChatRoom = static_pointer_cast<ClientGroupChatRoom>(
chatRoom->getCore()->getPrivate()->createClientGroupChatRoom(chatRoom->getSubject(), "", Content(), false, false) // TODO encrypted = false because chatroom migration
chatRoom->getCore()->getPrivate()->createClientGroupChatRoom(chatRoom->getSubject(), "", Content(), false, false)
);
clientGroupChatRoom->getPrivate()->setCallSessionListener(this);
clientGroupChatRoom->getPrivate()->setChatRoomListener(this);
......
......@@ -469,11 +469,11 @@ void ClientGroupChatRoom::addParticipants (
"misc", "one_to_one_chat_room_enabled", TRUE))
) {
d->capabilities |= ClientGroupChatRoom::Capabilities::OneToOne;
const IdentityAddress &me = getMe()->getAddress();
const IdentityAddress &participant = addresses.front();
bool encrypted = getCapabilities() & ClientGroupChatRoom::Capabilities::Encrypted;
auto existingChatRoom = getCore()->findOneToOneChatRoom(getLocalAddress(), participant, encrypted);
if (existingChatRoom) {
const IdentityAddress &me = getMe()->getAddress();
lError() << "Trying to create already existing " << (encrypted ? "" : "non-") << "encrypted one-to-one chatroom with participants: " <<
me << ", " << participant;
return;
......
......@@ -485,9 +485,7 @@ void ServerGroupChatRoomPrivate::addCompatibleParticipants (const IdentityAddres
q->addParticipants(compatibleParticipants, nullptr, false);
if ((capabilities & ServerGroupChatRoom::Capabilities::OneToOne) && (q->getParticipantCount() == 2)) {
// Insert the one-to-one chat room in Db if participants count is 2.
bool encrypted = false;
if ((capabilities & ServerGroupChatRoom::Capabilities::Encrypted))
encrypted = true;
bool encrypted = (capabilities & ServerGroupChatRoom::Capabilities::Encrypted);
q->getCore()->getPrivate()->mainDb->insertOneToOneConferenceChatRoom(q->getSharedFromThis(), encrypted);
}
}
......@@ -822,8 +820,8 @@ LocalConference(getCore(), IdentityAddress(linphone_proxy_config_get_conference_
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0))
d->capabilities |= ServerGroupChatRoom::Capabilities::OneToOne;
const char *endToEndEncryptedStr = sal_custom_header_find(op->getRecvCustomHeaders(), "End-To-End-Encrypted");
if (endToEndEncryptedStr && (strcmp(endToEndEncryptedStr, "true") == 0))
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(op->getRecvCustomHeaders(), "End-To-End-Encrypted"));
if (endToEndEncrypted == "true")
d->capabilities |= ServerGroupChatRoom::Capabilities::Encrypted;
shared_ptr<CallSession> session = getMe()->getPrivate()->createSession(*this, nullptr, false, d);
......
......@@ -316,7 +316,7 @@ ChatMessageModifier::Result LimeX3DHEncryptionEngine::processIncomingMessage (
if (incomingContentType != expectedContentType) {
lError() << "LIMEv2 unexpected content-type: " << incomingContentType;
// Set authoris</