Commit 4bbf7f1f authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed ChatMessage legacy getContentType and getText methods

parent 004d7741
......@@ -137,8 +137,12 @@ string ChatMessagePrivate::getSalCustomHeaderValue(const string& name) {
const string& ChatMessagePrivate::getContentType() {
if (internalContent) {
ContentType contentType = internalContent->getContentType();
cContentType = contentType.asString();
cContentType = internalContent->getContentType().asString();
} else {
if (contents.size() > 0) {
shared_ptr<Content> content = contents.front();
cContentType = content->getContentType().asString();
}
}
return cContentType;
}
......@@ -153,6 +157,11 @@ void ChatMessagePrivate::setContentType(const string& contentType) {
const string& ChatMessagePrivate::getText() {
if (internalContent) {
cText = internalContent->getBodyAsString();
} else {
if (contents.size() > 0) {
shared_ptr<Content> content = contents.front();
cText = content->getBodyAsString();
}
}
return cText;
}
......
......@@ -580,14 +580,10 @@ void ChatRoom::compose () {
}
shared_ptr<ChatMessage> ChatRoom::createFileTransferMessage (const LinphoneContent *initialContent) {
L_D();
shared_ptr<ChatMessage> chatMessage = createMessage();
chatMessage->getPrivate()->setDirection(ChatMessage::Direction::Outgoing);
chatMessage->getPrivate()->setFileTransferInformation(linphone_content_copy(initialContent));
chatMessage->setToAddress(d->peerAddress);
chatMessage->setFromAddress(linphone_core_get_identity(d->core));
return chatMessage;
}
......@@ -604,8 +600,11 @@ shared_ptr<ChatMessage> ChatRoom::createMessage (const string &message) {
}
shared_ptr<ChatMessage> ChatRoom::createMessage () {
L_D();
shared_ptr<ChatMessage> chatMessage = make_shared<ChatMessage>(static_pointer_cast<ChatRoom>(shared_from_this()));
chatMessage->getPrivate()->setTime(ms_time(0));
chatMessage->setToAddress(d->peerAddress);
chatMessage->setFromAddress(linphone_core_get_identity(d->core));
return chatMessage;
}
......
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