Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
f3085105
Commit
f3085105
authored
Nov 06, 2017
by
Sylvain Berfini
🐮
Browse files
Fixed multipart chat message with text + file transfer
parent
a4a221dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/linphone/api/c-chat-message.h
View file @
f3085105
...
...
@@ -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
...
...
src/c-wrapper/api/c-chat-message.cpp
View file @
f3085105
...
...
@@ -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
();
}
...
...
src/chat/chat-message/chat-message.cpp
View file @
f3085105
...
...
@@ -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
);
...
...
tester/message_tester.c
View file @
f3085105
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment