Commit 64e0f9b8 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed issue in From and To when receiving a message

parent 28e77ff2
......@@ -404,7 +404,8 @@ LinphoneReason ChatRoomPrivate::messageReceived (SalOp *op, const SalMessage *sa
content->setBody(salMsg->text ? salMsg->text : "");
msg->addContent(content);
msg->setToAddress( op->get_to() ? op->get_to() : linphone_core_get_identity(core));
msg->setToAddress(op->get_to() ? op->get_to() : linphone_core_get_identity(core));
msg->setFromAddress(peerAddress);
msg->getPrivate()->setTime(salMsg->time);
msg->getPrivate()->setState(ChatMessage::State::Delivered);
msg->getPrivate()->setDirection(ChatMessage::Direction::Incoming);
......@@ -543,7 +544,11 @@ void ChatRoom::compose () {
}
shared_ptr<ChatMessage> ChatRoom::createFileTransferMessage (const LinphoneContent *initialContent) {
L_D();
shared_ptr<ChatMessage> chatMessage = createMessage();
chatMessage->setToAddress(d->peerAddress);
chatMessage->setFromAddress(linphone_core_get_identity(d->core));
chatMessage->getPrivate()->setDirection(ChatMessage::Direction::Outgoing);
chatMessage->getPrivate()->setFileTransferInformation(linphone_content_copy(initialContent));
......@@ -552,6 +557,7 @@ shared_ptr<ChatMessage> ChatRoom::createFileTransferMessage (const LinphoneConte
}
shared_ptr<ChatMessage> ChatRoom::createMessage (const string &message) {
L_D();
shared_ptr<ChatMessage> chatMessage = createMessage();
shared_ptr<Content> content = make_shared<Content>();
......@@ -559,15 +565,15 @@ shared_ptr<ChatMessage> ChatRoom::createMessage (const string &message) {
content->setBody(message);
chatMessage->addContent(content);
chatMessage->setToAddress(d->peerAddress);
chatMessage->setFromAddress(linphone_core_get_identity(d->core));
return chatMessage;
}
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