mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Fixed cache string in c-chat-message
This commit is contained in:
parent
8ee8885d6a
commit
0b5defc743
2 changed files with 15 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue