mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 19:38:09 +00:00
fix(src/components/chat/ChatModel): handle correctly call state
This commit is contained in:
parent
71b04c5ece
commit
8fedfb58ac
5 changed files with 24 additions and 22 deletions
|
|
@ -176,25 +176,8 @@ ChatModel::ChatModel (QObject *parent) : QAbstractListModel(parent) {
|
|||
|
||||
core->getSipAddressesModel()->connectToChatModel(this);
|
||||
|
||||
QObject::connect(
|
||||
&(*m_core_handlers), &CoreHandlers::messageReceived,
|
||||
this, [this](const shared_ptr<linphone::ChatMessage> &message) {
|
||||
if (m_chat_room == message->getChatRoom()) {
|
||||
insertMessageAtEnd(message);
|
||||
resetMessagesCount();
|
||||
|
||||
emit messageReceived(message);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
&(*m_core_handlers), &CoreHandlers::callStateChanged,
|
||||
this, [this](const std::shared_ptr<linphone::Call> &call, linphone::CallState state) {
|
||||
if (state == linphone::CallStateEnd || state == linphone::CallStateError)
|
||||
insertCall(call->getCallLog());
|
||||
}
|
||||
);
|
||||
QObject::connect(&(*m_core_handlers), &CoreHandlers::messageReceived, this, &ChatModel::handleMessageReceived);
|
||||
QObject::connect(&(*m_core_handlers), &CoreHandlers::callStateChanged, this, &ChatModel::handleCallStateChanged);
|
||||
}
|
||||
|
||||
ChatModel::~ChatModel () {
|
||||
|
|
@ -580,3 +563,19 @@ void ChatModel::resetMessagesCount () {
|
|||
m_chat_room->markAsRead();
|
||||
emit messagesCountReset();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ChatModel::handleCallStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::CallState state) {
|
||||
if (m_chat_room == call->getChatRoom() && (state == linphone::CallStateEnd || state == linphone::CallStateError))
|
||||
insertCall(call->getCallLog());
|
||||
}
|
||||
|
||||
void ChatModel::handleMessageReceived (const std::shared_ptr<linphone::ChatMessage> &message) {
|
||||
if (m_chat_room == message->getChatRoom()) {
|
||||
insertMessageAtEnd(message);
|
||||
resetMessagesCount();
|
||||
|
||||
emit messageReceived(message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,9 @@ private:
|
|||
|
||||
void resetMessagesCount ();
|
||||
|
||||
void handleCallStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::CallState state);
|
||||
void handleMessageReceived (const std::shared_ptr<linphone::ChatMessage> &message);
|
||||
|
||||
QList<ChatEntryData> m_entries;
|
||||
std::shared_ptr<linphone::ChatRoom> m_chat_room;
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit cb6314384fd108ce206e1467e9c253bc8cddd161
|
||||
Subproject commit e93227f56dc0c2299de20ac1460bfdb72e8e695b
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit b64ed01b6d7a276fb39d3692ec9e737048135805
|
||||
Subproject commit 4c37a23c805e7f08c8874d848525a720c165c906
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit cca2555ca61485dc6ba4cdfb9a5cb17d48665049
|
||||
Subproject commit 15bc305047eacfc9ff7f8c733bdeef21b0a5842c
|
||||
Loading…
Add table
Reference in a new issue