diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 07545b264..e34294eab 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -121,6 +121,7 @@ void ChatList::setSelf(QSharedPointer me) { const std::shared_ptr &room, const std::shared_ptr &message) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + if (!message) return; auto receiverAddress = message->getToAddress(); if (!receiverAddress) { qWarning() << log().arg("Receiver account has no address, return"); diff --git a/Linphone/model/core/CoreModel.cpp b/Linphone/model/core/CoreModel.cpp index 7915cf189..06a4ea34f 100644 --- a/Linphone/model/core/CoreModel.cpp +++ b/Linphone/model/core/CoreModel.cpp @@ -526,18 +526,29 @@ void CoreModel::onLogCollectionUploadProgressIndication(const std::shared_ptr
  • &core, const std::shared_ptr &room, const std::shared_ptr &message) { + if (message->isOutgoing()) return; emit unreadNotificationsChanged(); std::list> messages; messages.push_back(message); - if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); + if (App::getInstance()->getNotifier()) { + App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); + } emit messageReceived(core, room, message); } void CoreModel::onMessagesReceived(const std::shared_ptr &core, const std::shared_ptr &room, const std::list> &messages) { - emit unreadNotificationsChanged(); - if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); - emit messagesReceived(core, room, messages); + std::list> finalMessages; + for (auto &message : messages) { + if (message->isOutgoing()) continue; + finalMessages.push_back(message); + } + if (finalMessages.size() > 0) { + emit unreadNotificationsChanged(); + emit messagesReceived(core, room, finalMessages); + } + if (App::getInstance()->getNotifier()) + App::getInstance()->getNotifier()->notifyReceivedMessages(room, finalMessages); } void CoreModel::onNewMessageReaction(const std::shared_ptr &core,