mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-02 03:09:23 +00:00
Handle file transfer download to a file.
This commit is contained in:
parent
be7cb58b18
commit
9a128da1db
2 changed files with 24 additions and 13 deletions
|
|
@ -1075,10 +1075,17 @@ static void linphone_chat_process_response_headers_from_get_file(void *data, con
|
|||
body_size = message->file_transfer_information->size;
|
||||
}
|
||||
|
||||
belle_sip_message_set_body_handler(
|
||||
(belle_sip_message_t*)event->response,
|
||||
(belle_sip_body_handler_t*)belle_sip_user_body_handler_new(body_size, linphone_chat_message_file_transfer_on_progress,on_recv_body,NULL,message)
|
||||
);
|
||||
if (message->file_transfer_filepath == NULL) {
|
||||
belle_sip_message_set_body_handler(
|
||||
(belle_sip_message_t*)event->response,
|
||||
(belle_sip_body_handler_t*)belle_sip_user_body_handler_new(body_size, linphone_chat_message_file_transfer_on_progress,on_recv_body,NULL,message)
|
||||
);
|
||||
} else {
|
||||
belle_sip_message_set_body_handler(
|
||||
(belle_sip_message_t *)event->response,
|
||||
(belle_sip_body_handler_t *)belle_sip_file_body_handler_new(message->file_transfer_filepath, linphone_chat_message_file_transfer_on_progress, message)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1362,6 +1369,18 @@ LinphoneReason linphone_chat_message_get_reason(LinphoneChatMessage* msg) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the path to the file to read from or write to during the file transfer.
|
||||
* @param[in] msg LinphoneChatMessage object
|
||||
* @param[in] filepath The path to the file to use for the file transfer.
|
||||
*/
|
||||
void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath) {
|
||||
if (msg->file_transfer_filepath != NULL) {
|
||||
ms_free(msg->file_transfer_filepath);
|
||||
}
|
||||
msg->file_transfer_filepath = ms_strdup(filepath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a message attached to a dedicated chat room with a particular content. Use #linphone_chat_room_send_message2 to initiate the transfer
|
||||
|
|
@ -1385,15 +1404,6 @@ LinphoneChatMessage* linphone_chat_room_create_file_transfer_message(LinphoneCha
|
|||
return msg;
|
||||
}
|
||||
|
||||
LinphoneChatMessage * linphone_chat_room_create_file_transfer_message_from_file(LinphoneChatRoom *cr, LinphoneContent *initial_content, const char *filepath) {
|
||||
LinphoneChatMessage *msg = linphone_chat_room_create_file_transfer_message(cr, initial_content);
|
||||
if (msg->file_transfer_filepath != NULL) {
|
||||
ms_free(msg->file_transfer_filepath);
|
||||
}
|
||||
msg->file_transfer_filepath = ms_strdup(filepath);
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1450,6 +1450,7 @@ LINPHONE_PUBLIC bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage* me
|
|||
LINPHONE_PUBLIC unsigned int linphone_chat_message_get_storage_id(LinphoneChatMessage* message);
|
||||
LINPHONE_PUBLIC LinphoneReason linphone_chat_message_get_reason(LinphoneChatMessage* msg);
|
||||
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_chat_message_get_error_info(const LinphoneChatMessage *msg);
|
||||
LINPHONE_PUBLIC void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue