mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 20:48:07 +00:00
Fixes for LIME when used with file body handler (requires belle-sip 1.5.0-133 or newer)
This commit is contained in:
parent
c43ce43d56
commit
2b407fabfa
4 changed files with 10 additions and 6 deletions
|
|
@ -133,7 +133,7 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
|
|||
LinphoneImEncryptionEngineCbsUploadingFileCb cb_process_uploading_file = linphone_im_encryption_engine_cbs_get_process_uploading_file(imee_cbs);
|
||||
if (cb_process_uploading_file) {
|
||||
char *encrypted_buffer = (char *)ms_malloc0(*size);
|
||||
retval = cb_process_uploading_file(imee, msg, offset, (char *)buffer, size, encrypted_buffer);
|
||||
retval = cb_process_uploading_file(imee, msg, offset, (const char *)buffer, size, encrypted_buffer);
|
||||
if (retval == 0) {
|
||||
memcpy(buffer, encrypted_buffer, *size);
|
||||
}
|
||||
|
|
@ -234,7 +234,8 @@ static void linphone_chat_message_process_response_from_post_file(void *data,
|
|||
if (msg->file_transfer_filepath != NULL) {
|
||||
belle_sip_user_body_handler_t *body_handler = (belle_sip_user_body_handler_t *)first_part_bh;
|
||||
first_part_bh = (belle_sip_body_handler_t *)belle_sip_file_body_handler_new(msg->file_transfer_filepath,
|
||||
linphone_chat_message_file_transfer_on_progress, msg);
|
||||
NULL, msg); // No need to add again the callback for progression, otherwise it will be called twice
|
||||
linphone_content_set_size(msg->file_transfer_information, belle_sip_file_body_handler_get_file_size((belle_sip_file_body_handler_t *)first_part_bh));
|
||||
belle_sip_file_body_handler_set_user_body_handler((belle_sip_file_body_handler_t *)first_part_bh, body_handler);
|
||||
} else if (linphone_content_get_buffer(msg->file_transfer_information) != NULL) {
|
||||
first_part_bh = (belle_sip_body_handler_t *)belle_sip_memory_body_handler_new_from_buffer(
|
||||
|
|
|
|||
|
|
@ -1031,13 +1031,16 @@ int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEn
|
|||
}
|
||||
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer) {
|
||||
size_t file_size = linphone_content_get_size(msg->file_transfer_information);
|
||||
if (linphone_content_get_key(msg->file_transfer_information) == NULL) return -1;
|
||||
|
||||
if (buffer == NULL || *size == 0) {
|
||||
return lime_encryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information), NULL, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
if (offset + *size < linphone_content_get_size(msg->file_transfer_information)) {
|
||||
if (file_size == 0) {
|
||||
ms_warning("File size has not been set, encryption will fail if not done in one step (if file is larger than 16K)");
|
||||
} else if (offset + *size < file_size) {
|
||||
*size -= (*size % 16);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2167,7 +2167,7 @@ LinphoneLimeState linphone_core_lime_enabled(const LinphoneCore *lc){
|
|||
LinphoneLimeState linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc){
|
||||
LinphoneLimeState s = linphone_core_lime_enabled(lc);
|
||||
if (s != LinphoneLimeDisabled) {
|
||||
s = lp_config_get_int(lc->config,"sip", "lime_for_file_sharing", LinphoneLimeMandatory);
|
||||
s = lp_config_get_int(lc->config,"sip", "lime_for_file_sharing", 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,8 +220,8 @@ LinphoneChatMessage* create_message_from_nowebcam(LinphoneChatRoom *chat_room) {
|
|||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneContent* content;
|
||||
LinphoneChatMessage* msg;
|
||||
size_t file_size;
|
||||
char *send_filepath = bc_tester_res("images/nowebcamVGA.jpg");
|
||||
size_t file_size;
|
||||
file_to_send = fopen(send_filepath, "rb");
|
||||
fseek(file_to_send, 0, SEEK_END);
|
||||
file_size = ftell(file_to_send);
|
||||
|
|
@ -1237,7 +1237,7 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
|
|||
linphone_core_enable_lime(pauline->lc, LinphoneLimeMandatory);
|
||||
if (!encrypt_file) {
|
||||
LpConfig *pauline_lp = linphone_core_get_config(pauline->lc);
|
||||
lp_config_set_int(pauline_lp,"sip","lime_for_file_sharing",0);
|
||||
lp_config_set_int(pauline_lp, "sip", "lime_for_file_sharing", 0);
|
||||
}
|
||||
|
||||
/* set the zid caches files : create two ZID cache from this valid one inserting the auto-generated sip URI for the peer account as keys in ZID cache are indexed by peer sip uri */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue