mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 21:28:08 +00:00
don't notify a NotDelivered state if an incoming file transfer fails
This commit is contained in:
parent
ad843755c3
commit
8a7cfe66d6
3 changed files with 19 additions and 9 deletions
|
|
@ -451,7 +451,7 @@ static void linphone_chat_process_response_from_get_file(void *data, const belle
|
|||
}
|
||||
}
|
||||
|
||||
void _linphone_chat_room_start_http_transfer(LinphoneChatMessage *msg, const char* url, const char* action, const belle_http_request_listener_callbacks_t *cbs) {
|
||||
int _linphone_chat_room_start_http_transfer(LinphoneChatMessage *msg, const char* url, const char* action, const belle_http_request_listener_callbacks_t *cbs) {
|
||||
belle_generic_uri_t *uri = NULL;
|
||||
char* ua;
|
||||
|
||||
|
|
@ -479,31 +479,41 @@ void _linphone_chat_room_start_http_transfer(LinphoneChatMessage *msg, const cha
|
|||
/* give msg to listener to be able to start the actual file upload when server answer a 204 No content */
|
||||
msg->http_listener = belle_http_request_listener_create_from_callbacks(cbs, linphone_chat_message_ref(msg));
|
||||
belle_http_provider_send_request(msg->chat_room->lc->http_provider, msg->http_request, msg->http_listener);
|
||||
return;
|
||||
return 0;
|
||||
error:
|
||||
if (uri) {
|
||||
belle_sip_object_unref(uri);
|
||||
}
|
||||
linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void linphone_chat_room_upload_file(LinphoneChatMessage *msg) {
|
||||
int linphone_chat_room_upload_file(LinphoneChatMessage *msg) {
|
||||
belle_http_request_listener_callbacks_t cbs = {0};
|
||||
int err;
|
||||
|
||||
cbs.process_response = linphone_chat_message_process_response_from_post_file;
|
||||
cbs.process_io_error = linphone_chat_message_process_io_error_upload;
|
||||
cbs.process_auth_requested = linphone_chat_message_process_auth_requested_upload;
|
||||
_linphone_chat_room_start_http_transfer(msg, linphone_core_get_file_transfer_server(msg->chat_room->lc), "POST", &cbs);
|
||||
err = _linphone_chat_room_start_http_transfer(msg, linphone_core_get_file_transfer_server(msg->chat_room->lc), "POST", &cbs);
|
||||
if (err == -1){
|
||||
linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
void linphone_chat_message_download_file(LinphoneChatMessage *msg) {
|
||||
int linphone_chat_message_download_file(LinphoneChatMessage *msg) {
|
||||
belle_http_request_listener_callbacks_t cbs = {0};
|
||||
int err;
|
||||
|
||||
cbs.process_response_headers = linphone_chat_process_response_headers_from_get_file;
|
||||
cbs.process_response = linphone_chat_process_response_from_get_file;
|
||||
cbs.process_io_error = linphone_chat_message_process_io_error_download;
|
||||
cbs.process_auth_requested = linphone_chat_message_process_auth_requested_download;
|
||||
_linphone_chat_room_start_http_transfer(msg, msg->external_body_url, "GET", &cbs);
|
||||
err = _linphone_chat_room_start_http_transfer(msg, msg->external_body_url, "GET", &cbs);
|
||||
if (err == -1) return -1;
|
||||
/* start the download, status is In Progress */
|
||||
linphone_chat_message_set_state(msg, LinphoneChatMessageStateInProgress);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void linphone_chat_message_start_file_download(LinphoneChatMessage *msg,
|
||||
|
|
|
|||
|
|
@ -1556,7 +1556,7 @@ LINPHONE_PUBLIC void linphone_chat_message_start_file_download(LinphoneChatMessa
|
|||
* Start the download of the file referenced in a LinphoneChatMessage from remote server.
|
||||
* @param[in] message LinphoneChatMessage object.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_download_file(LinphoneChatMessage *message);
|
||||
LINPHONE_PUBLIC int linphone_chat_message_download_file(LinphoneChatMessage *message);
|
||||
/**
|
||||
* Cancel an ongoing file transfer attached to this message.(upload or download)
|
||||
* @param msg #LinphoneChatMessage
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ void linphone_chat_room_release(LinphoneChatRoom *cr);
|
|||
void linphone_chat_message_destroy(LinphoneChatMessage* msg);
|
||||
void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state);
|
||||
void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state);
|
||||
void linphone_chat_room_upload_file(LinphoneChatMessage *msg);
|
||||
int linphone_chat_room_upload_file(LinphoneChatMessage *msg);
|
||||
void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
|
||||
LinphoneChatMessageCbs *linphone_chat_message_cbs_new(void);
|
||||
LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue