feat(MessageCount): use new API to deal correctly with locals

This commit is contained in:
Ronan Abhamon 2018-08-28 14:46:10 +02:00
parent 894428b76f
commit 2440635278
3 changed files with 2 additions and 12 deletions

View file

@ -622,7 +622,6 @@ void ChatModel::removeEntry (ChatEntryData &entry) {
void ChatModel::insertCall (const shared_ptr<linphone::CallLog> &callLog) {
linphone::Call::Status status = callLog->getStatus();
switch (status) {
case linphone::Call::Status::Aborted:
case linphone::Call::Status::EarlyAborted:

View file

@ -39,7 +39,7 @@ AbstractMessageCountNotifier::AbstractMessageCountNotifier (QObject *parent) : Q
);
QObject::connect(
coreManager->getHandlers().get(), &CoreHandlers::messageReceived,
this, &AbstractMessageCountNotifier::handleMessageReceived
this, &AbstractMessageCountNotifier::updateUnreadMessageCount
);
QObject::connect(
coreManager->getSettingsModel(), &SettingsModel::chatEnabledChanged,
@ -50,10 +50,7 @@ AbstractMessageCountNotifier::AbstractMessageCountNotifier (QObject *parent) : Q
// -----------------------------------------------------------------------------
void AbstractMessageCountNotifier::updateUnreadMessageCount () {
mUnreadMessageCount = 0;
for (const auto &chatRoom : CoreManager::getInstance()->getCore()->getChatRooms())
mUnreadMessageCount += chatRoom->getUnreadMessagesCount();
mUnreadMessageCount = CoreManager::getInstance()->getCore()->getUnreadChatMessageCountFromActiveLocals();
internalNotifyUnreadMessageCount();
}
@ -72,8 +69,3 @@ void AbstractMessageCountNotifier::handleChatModelCreated (const shared_ptr<Chat
this, &AbstractMessageCountNotifier::updateUnreadMessageCount
);
}
void AbstractMessageCountNotifier::handleMessageReceived (const shared_ptr<linphone::ChatMessage> &) {
mUnreadMessageCount++;
internalNotifyUnreadMessageCount();
}

View file

@ -50,7 +50,6 @@ private:
void internalNotifyUnreadMessageCount ();
void handleChatModelCreated (const std::shared_ptr<ChatModel> &chatModel);
void handleMessageReceived (const std::shared_ptr<linphone::ChatMessage> &message);
int mUnreadMessageCount = 0;
};