diff --git a/src/CallManager.cpp b/src/CallManager.cpp index 9864b20301aff48b6d5660634994543eb13a0797..f725d49f8e240fc6d5196e2e2e268cd86ba73cad 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp @@ -351,12 +351,15 @@ CallManager::handleEvent(const RoomEvent<CallAnswer> &callAnswerEvent) callAnswerEvent.content.call_id, callAnswerEvent.sender); - if (!isOnCall() && callAnswerEvent.sender == utils::localUser().toStdString() && + if (callAnswerEvent.sender == utils::localUser().toStdString() && callid_ == callAnswerEvent.content.call_id) { - emit ChatPage::instance()->showNotification("Call answered on another device."); - stopRingtone(); - haveCallInvite_ = false; - emit newInviteState(); + if (!isOnCall()) { + emit ChatPage::instance()->showNotification( + "Call answered on another device."); + stopRingtone(); + haveCallInvite_ = false; + emit newInviteState(); + } return; } diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index adef886d2a459a6bb44fdc8a90cd0e8bf56908f1..2b5b5794c1d91b73f78a0ff313676b919f49f206 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -613,8 +613,13 @@ TimelineModel::addEvents(const mtx::responses::Timeline &timeline) std::visit( [this](auto &event) { event.room_id = room_id_.toStdString(); - if (event.sender != http::client()->user_id().to_string()) + if constexpr (std::is_same_v<std::decay_t<decltype(event)>, + RoomEvent<msg::CallAnswer>>) emit newCallEvent(event); + else { + if (event.sender != http::client()->user_id().to_string()) + emit newCallEvent(event); + } }, e); else if (std::holds_alternative<StateEvent<state::Avatar>>(e))