summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortrilene <trilene@runbox.com>2020-07-16 13:31:38 -0400
committertrilene <trilene@runbox.com>2020-07-16 13:31:38 -0400
commit8968d51b6521dfc11d9f9107a8d4d923710143f3 (patch)
tree3aad82d32ca20bc5aa2cca9058d3a6cca714805c /src
parentHide incoming CallCandidates in encrypted rooms (diff)
downloadnheko-8968d51b6521dfc11d9f9107a8d4d923710143f3.tar.xz
Handle preemptive CallAnswer from fellow device
Diffstat (limited to 'src')
-rw-r--r--src/CallManager.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/CallManager.cpp b/src/CallManager.cpp
index 05e8afc3..dbcf55b9 100644
--- a/src/CallManager.cpp
+++ b/src/CallManager.cpp
@@ -207,7 +207,11 @@ CallManager::answerInvite(const CallInvite &invite)
 void
 CallManager::handleEvent(const RoomEvent<CallCandidates> &callCandidatesEvent)
 {
+  if (callCandidatesEvent.sender == utils::localUser().toStdString())
+    return;
+
   nhlog::ui()->debug("CallManager::incoming CallCandidates from {} with id {}", callCandidatesEvent.sender, callCandidatesEvent.content.call_id);
+
   if (callid_ == callCandidatesEvent.content.call_id) {
     if (onActiveCall())
       session_.acceptICECandidates(callCandidatesEvent.content.candidates);
@@ -223,6 +227,14 @@ void
 CallManager::handleEvent(const RoomEvent<CallAnswer> &callAnswerEvent)
 {
   nhlog::ui()->debug("CallManager::incoming CallAnswer from {} with id {}", callAnswerEvent.sender, callAnswerEvent.content.call_id);
+
+  if (!onActiveCall() && callAnswerEvent.sender == utils::localUser().toStdString() &&
+      callid_ == callAnswerEvent.content.call_id) {
+    stopRingtone();
+    MainWindow::instance()->hideOverlay();
+    return;
+  }
+
   if (onActiveCall() && callid_ == callAnswerEvent.content.call_id) {
     stopRingtone();
     if (!session_.acceptAnswer(callAnswerEvent.content.sdp)) {