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
0b5defc7
Commit
0b5defc7
authored
Oct 05, 2017
by
Sylvain Berfini
🐮
Browse files
Fixed cache string in c-chat-message
parent
8ee8885d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
src/c-wrapper/api/c-chat-message.cpp
src/c-wrapper/api/c-chat-message.cpp
+8
-3
src/chat/chat-room.cpp
src/chat/chat-room.cpp
+7
-1
No files found.
src/c-wrapper/api/c-chat-message.cpp
View file @
0b5defc7
...
...
@@ -46,7 +46,7 @@ L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(ChatMessage,
LinphoneAddress
*
to
;
// cache for shared_ptr<Address>
LinphoneChatMessageStateChangedCb
message_state_changed_cb
;
void
*
message_state_changed_user_data
;
mutable
string
contentTypeCache
;
mutable
char
*
contentTypeCache
;
)
static
void
_linphone_chat_message_constructor
(
LinphoneChatMessage
*
msg
)
{
...
...
@@ -60,6 +60,8 @@ static void _linphone_chat_message_destructor (LinphoneChatMessage *msg) {
linphone_address_unref
(
msg
->
from
);
if
(
msg
->
to
)
linphone_address_unref
(
msg
->
to
);
if
(
msg
->
contentTypeCache
)
ms_free
(
msg
->
contentTypeCache
);
}
// =============================================================================
...
...
@@ -319,8 +321,11 @@ void * linphone_chat_message_get_message_state_changed_cb_user_data(LinphoneChat
// =============================================================================
const
char
*
linphone_chat_message_get_content_type
(
LinphoneChatMessage
*
msg
)
{
msg
->
contentTypeCache
=
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
getContentType
().
asString
();
return
L_STRING_TO_C
(
msg
->
contentTypeCache
);
if
(
msg
->
contentTypeCache
)
{
ms_free
(
msg
->
contentTypeCache
);
}
msg
->
contentTypeCache
=
ms_strdup
(
L_STRING_TO_C
(
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
getContentType
().
asString
()));
return
msg
->
contentTypeCache
;
}
void
linphone_chat_message_set_content_type
(
LinphoneChatMessage
*
msg
,
const
char
*
content_type
)
{
...
...
src/chat/chat-room.cpp
View file @
0b5defc7
...
...
@@ -551,6 +551,12 @@ void ChatRoom::compose () {
shared_ptr
<
ChatMessage
>
ChatRoom
::
createFileTransferMessage
(
const
LinphoneContent
*
initialContent
)
{
L_D
();
shared_ptr
<
ChatMessage
>
chatMessage
=
createMessage
();
/* TODO
Content content;
content.setContentType(ContentType::FileTransfer);
content.setBody(linphone_content_get_string_buffer(initialContent));
chatMessage->addContent(content);*/
chatMessage
->
setToAddress
(
d
->
peerAddress
);
chatMessage
->
setFromAddress
(
linphone_core_get_identity
(
d
->
core
));
...
...
@@ -565,7 +571,7 @@ shared_ptr<ChatMessage> ChatRoom::createMessage (const string &message) {
shared_ptr
<
ChatMessage
>
chatMessage
=
createMessage
();
Content
content
;
content
.
setContentType
(
"text/plain"
);
content
.
setContentType
(
ContentType
::
PlainText
);
content
.
setBody
(
message
);
chatMessage
->
addContent
(
content
);
...
...
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