Commit f3085105 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed multipart chat message with text + file transfer

parent a4a221dc
......@@ -365,7 +365,7 @@ LINPHONE_PUBLIC bool_t linphone_chat_message_has_text_content(const LinphoneChat
* @param[in] msg LinphoneChatMessage object
* @return true if it has one, false otherwise
*/
LINPHONE_PUBLIC bool_t linphone_chat_message_has_file_content(const LinphoneChatMessage *msg);
LINPHONE_PUBLIC bool_t linphone_chat_message_has_file_transfer_content(const LinphoneChatMessage *msg);
/**
* Gets the text content if available as a string
......
......@@ -309,7 +309,7 @@ bool_t linphone_chat_message_has_text_content(const LinphoneChatMessage *msg) {
return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->hasTextContent();
}
bool_t linphone_chat_message_has_file_content(const LinphoneChatMessage *msg) {
bool_t linphone_chat_message_has_file_transfer_content(const LinphoneChatMessage *msg) {
return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->hasFileTransferContent();
}
......
......@@ -764,7 +764,7 @@ void ChatMessagePrivate::processResponseFromPostFile (const belle_http_response_
Content fileTransferContent;
fileTransferContent.setContentType(ContentType::FileTransfer);
fileTransferContent.setBody(linphone_content_get_string_buffer(cFileTransferInformation));
fileTransferContent.setBody(getText());
q->addContent(fileTransferContent);
q->updateState(ChatMessage::State::FileTransferDone);
......
......@@ -2310,6 +2310,9 @@ void file_and_text_message(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc");
LpConfig *config = linphone_core_get_config(pauline->lc);
lp_config_set_int(config, "sip", "use_cpim", 1);
char *send_filepath = bc_tester_res("sounds/sintel_trailer_opus_h264.mkv");
char *receive_filepath = bc_tester_file("receive_file.dump");
LinphoneChatRoom* chat_room;
......@@ -2331,18 +2334,20 @@ void file_and_text_message(void) {
BC_ASSERT_TRUE(linphone_chat_message_has_text_content(msg));
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text_content(msg), "Text message");
BC_ASSERT_FALSE(linphone_chat_message_has_file_content(msg));
BC_ASSERT_FALSE(linphone_chat_message_has_file_transfer_content(msg)); // On sender side, content is a file content, not a file transfer
linphone_chat_room_send_chat_message(chat_room, msg);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceivedWithFile, 1, 60000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1, 60000));
BC_ASSERT_TRUE(linphone_chat_message_has_file_transfer_content(msg)); // Once sent, it should have the file transfer content
if (marie->stat.last_received_chat_message) {
LinphoneChatMessage *recv_msg;
recv_msg = marie->stat.last_received_chat_message;
BC_ASSERT_TRUE(linphone_chat_message_has_text_content(recv_msg));
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text_content(recv_msg), "Text message");
BC_ASSERT_TRUE(linphone_chat_message_has_file_content(recv_msg));
BC_ASSERT_TRUE(linphone_chat_message_has_file_transfer_content(recv_msg));
cbs = linphone_chat_message_get_callbacks(recv_msg);
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment