diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 7cbd43616..4c2990a3e 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -1497,3 +1497,11 @@ void sal_add_content_type_support(Sal *sal, const char *content_type) { sal->supported_content_types = bctbx_list_append(sal->supported_content_types, ms_strdup(content_type)); } } + +void sal_remove_content_type_support(Sal *sal, const char *content_type) { + if (content_type != NULL) { + if (bctbx_list_find(sal->supported_content_types, content_type)) { + sal->supported_content_types = bctbx_list_remove(sal->supported_content_types, (char *)content_type); + } + } +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c4f07e691..9206f8cc0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2431,8 +2431,8 @@ void linphone_core_enable_lime(LinphoneCore *lc, LinphoneLimeState val){ LinphoneImEncryptionEngine *imee = linphone_im_encryption_engine_new(); LinphoneImEncryptionEngineCbs *cbs = linphone_im_encryption_engine_get_callbacks(imee); - if(lime_is_available()){ - if (linphone_core_ready(lc)){ + if (lime_is_available()) { + if (linphone_core_ready(lc)) { lp_config_set_int(lc->config,"sip","lime",val); } @@ -2444,11 +2444,15 @@ void linphone_core_enable_lime(LinphoneCore *lc, LinphoneLimeState val){ linphone_im_encryption_engine_cbs_set_process_uploading_file(cbs, lime_im_encryption_engine_process_uploading_file_cb); linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(cbs, lime_im_encryption_engine_is_file_encryption_enabled_cb); linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(cbs, lime_im_encryption_engine_generate_file_transfer_key_cb); + + linphone_core_add_content_type_support(lc, "xml/cipher"); } else { linphone_im_encryption_engine_cbs_set_process_outgoing_message(cbs, NULL); linphone_im_encryption_engine_cbs_set_process_uploading_file(cbs, NULL); linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(cbs, NULL); linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(cbs, NULL); + + linphone_core_remove_content_type_support(lc, "xml/cipher"); } linphone_core_set_im_encryption_engine(lc, imee); @@ -7318,6 +7322,10 @@ void linphone_core_add_content_type_support(LinphoneCore *lc, const char *conten sal_add_content_type_support(lc->sal, content_type); } +void linphone_core_remove_content_type_support(LinphoneCore *lc, const char *content_type) { + sal_remove_content_type_support(lc->sal, content_type); +} + #ifdef ENABLE_UPDATE_CHECK static void update_check_process_terminated(LinphoneCore *lc, LinphoneVersionUpdateCheckResult result, const char *version, const char *url) { linphone_core_notify_version_update_check_result_received(lc, result, version, url); diff --git a/include/linphone/core.h b/include/linphone/core.h index d06335409..c6b1750a5 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -4875,6 +4875,14 @@ LINPHONE_PUBLIC bool_t linphone_core_is_content_type_supported(const LinphoneCor */ LINPHONE_PUBLIC void linphone_core_add_content_type_support(LinphoneCore *lc, const char *content_type); +/** + * Remove support for the specified content type. + * It is the application responsibility to handle it correctly afterwards. + * @param[in] lc LinphoneCore object + * @param[in] content_type The content type to remove support for + */ +LINPHONE_PUBLIC void linphone_core_remove_content_type_support(LinphoneCore *lc, const char *content_type); + /** * @addtogroup chatroom diff --git a/include/sal/sal.h b/include/sal/sal.h index 17cc3c8b5..ac843e877 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -643,6 +643,7 @@ int sal_set_tunnel(Sal *ctx, void *tunnelclient); void sal_enable_sip_update_method(Sal *ctx,bool_t value); bool_t sal_is_content_type_supported(const Sal *sal, const char *content_type); void sal_add_content_type_support(Sal *sal, const char *content_type); +void sal_remove_content_type_support(Sal *sal, const char *content_type); /** * returns keepalive period in ms