Commit 57e8390e authored by Ronan's avatar Ronan

fix(SipAddressesModel): handle correctly received/sent messages

parent 184b0843
...@@ -287,6 +287,7 @@ void SipAddressesModel::handleSipAddressRemoved (ContactModel *contact, const QS ...@@ -287,6 +287,7 @@ void SipAddressesModel::handleSipAddressRemoved (ContactModel *contact, const QS
} }
void SipAddressesModel::handleMessageReceived (const shared_ptr<linphone::ChatMessage> &message) { void SipAddressesModel::handleMessageReceived (const shared_ptr<linphone::ChatMessage> &message) {
qInfo() << "Handle message received.";
const QString peerAddress(Utils::coreStringToAppString(message->getChatRoom()->getPeerAddress()->asStringUriOnly())); const QString peerAddress(Utils::coreStringToAppString(message->getChatRoom()->getPeerAddress()->asStringUriOnly()));
addOrUpdateSipAddress(peerAddress, message); addOrUpdateSipAddress(peerAddress, message);
} }
...@@ -405,8 +406,9 @@ void SipAddressesModel::handleMessageCountReset (ChatModel *chatModel) { ...@@ -405,8 +406,9 @@ void SipAddressesModel::handleMessageCountReset (ChatModel *chatModel) {
} }
void SipAddressesModel::handleMessageSent (const shared_ptr<linphone::ChatMessage> &message) { void SipAddressesModel::handleMessageSent (const shared_ptr<linphone::ChatMessage> &message) {
const QString localAddress(Utils::coreStringToAppString(message->getChatRoom()->getLocalAddress()->asStringUriOnly())); qInfo() << "Handle message sent.";
addOrUpdateSipAddress(localAddress, message); const QString peerAddress(Utils::coreStringToAppString(message->getChatRoom()->getPeerAddress()->asStringUriOnly()));
addOrUpdateSipAddress(peerAddress, message);
} }
void SipAddressesModel::handleIsComposingChanged (const shared_ptr<linphone::ChatRoom> &chatRoom) { void SipAddressesModel::handleIsComposingChanged (const shared_ptr<linphone::ChatRoom> &chatRoom) {
...@@ -455,11 +457,7 @@ void SipAddressesModel::addOrUpdateSipAddress (SipAddressEntry &sipAddressEntry, ...@@ -455,11 +457,7 @@ void SipAddressesModel::addOrUpdateSipAddress (SipAddressEntry &sipAddressEntry,
shared_ptr<linphone::ChatRoom> chatRoom(message->getChatRoom()); shared_ptr<linphone::ChatRoom> chatRoom(message->getChatRoom());
int count = chatRoom->getUnreadMessagesCount(); int count = chatRoom->getUnreadMessagesCount();
QString localAddress(Utils::coreStringToAppString( QString localAddress(Utils::coreStringToAppString(chatRoom->getLocalAddress()->asStringUriOnly()));
message->isOutgoing()
? chatRoom->getPeerAddress()->asStringUriOnly()
: chatRoom->getLocalAddress()->asStringUriOnly()
));
qInfo() << QStringLiteral("Update (`%1`, `%2`) from chat message.").arg(sipAddressEntry.sipAddress, localAddress); qInfo() << QStringLiteral("Update (`%1`, `%2`) from chat message.").arg(sipAddressEntry.sipAddress, localAddress);
ConferenceEntry &conferenceEntry = sipAddressEntry.localAddressToConferenceEntry[localAddress]; ConferenceEntry &conferenceEntry = sipAddressEntry.localAddressToConferenceEntry[localAddress];
......
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