Fixed LIME

This commit is contained in:
Sylvain Berfini 2018-02-06 14:01:27 +01:00
parent b340abdc0d
commit a8bdc5976d
4 changed files with 27 additions and 2 deletions

View file

@ -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);
}
}
}

View file

@ -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);

View file

@ -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

View file

@ -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