mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
There is no longer a dummy call to the file_transfer_recv callback at the beginning of a file download.
This commit is contained in:
parent
78a06d3e54
commit
24f4d44496
2 changed files with 22 additions and 24 deletions
|
|
@ -69,19 +69,18 @@ static void file_transfer_received(LinphoneChatMessage *message, const LinphoneC
|
|||
/*first chunk, creating file*/
|
||||
file = fopen("receive_file.dump","wb");
|
||||
linphone_chat_message_set_user_data(message,(void*)file); /*store fd for next chunks*/
|
||||
} else {
|
||||
/*next chunk*/
|
||||
file = (FILE*)linphone_chat_message_get_user_data(message);
|
||||
if (linphone_buffer_is_empty(buffer)) {
|
||||
printf("File transfert completed\n");
|
||||
linphone_chat_room_destroy(linphone_chat_message_get_chat_room(message));
|
||||
linphone_chat_message_destroy(message);
|
||||
fclose(file);
|
||||
running=FALSE;
|
||||
} else { /* store content on a file*/
|
||||
if (fwrite(linphone_buffer_get_content(buffer),linphone_buffer_get_size(buffer),1,file)==-1){
|
||||
ms_warning("file_transfer_received() write failed: %s",strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
file = (FILE*)linphone_chat_message_get_user_data(message);
|
||||
if (linphone_buffer_is_empty(buffer)) {
|
||||
printf("File transfert completed\n");
|
||||
linphone_chat_room_destroy(linphone_chat_message_get_chat_room(message));
|
||||
linphone_chat_message_destroy(message);
|
||||
fclose(file);
|
||||
running=FALSE;
|
||||
} else { /* store content on a file*/
|
||||
if (fwrite(linphone_buffer_get_content(buffer),linphone_buffer_get_size(buffer),1,file)==-1){
|
||||
ms_warning("file_transfer_received() write failed: %s",strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,18 +72,17 @@ void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent*
|
|||
/*first chunk, creating file*/
|
||||
file = fopen(receive_file,"wb");
|
||||
linphone_chat_message_set_user_data(message,(void*)file); /*store fd for next chunks*/
|
||||
} else {
|
||||
/*next chunk*/
|
||||
file = (FILE*)linphone_chat_message_get_user_data(message);
|
||||
}
|
||||
|
||||
if (linphone_buffer_is_empty(buffer)) { /* tranfer complete */
|
||||
stats* counters = get_stats(lc);
|
||||
counters->number_of_LinphoneMessageExtBodyReceived++;
|
||||
fclose(file);
|
||||
} else { /* store content on a file*/
|
||||
if (fwrite(linphone_buffer_get_content(buffer),linphone_buffer_get_size(buffer),1,file)==-1){
|
||||
ms_error("file_transfer_received(): write() failed: %s",strerror(errno));
|
||||
}
|
||||
file = (FILE*)linphone_chat_message_get_user_data(message);
|
||||
|
||||
if (linphone_buffer_is_empty(buffer)) { /* tranfer complete */
|
||||
stats* counters = get_stats(lc);
|
||||
counters->number_of_LinphoneMessageExtBodyReceived++;
|
||||
fclose(file);
|
||||
} else { /* store content on a file*/
|
||||
if (fwrite(linphone_buffer_get_content(buffer),linphone_buffer_get_size(buffer),1,file)==-1){
|
||||
ms_error("file_transfer_received(): write() failed: %s",strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue