From 3e5ee2fb8e5d5595ba783a8227951bb1738e951a Mon Sep 17 00:00:00 2001
From: ababi <albert.babi@savoirfairelinux.com>
Date: Tue, 29 Sep 2020 15:41:20 +0200
Subject: [PATCH] auto_answer: switch to incoming call

- shows callview for auto-answered incoming calls
- if call is not for current account shows a notification

Gitlab: #103
Change-Id: Ia482abc575f13b9d7eebd701ac1d51d2089de2b7
---
 src/calladapter.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/calladapter.cpp b/src/calladapter.cpp
index 604534d56..2ab9dc775 100644
--- a/src/calladapter.cpp
+++ b/src/calladapter.cpp
@@ -155,7 +155,7 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati
         }
     } else {
         auto accountProperties = LRCInstance::accountModel().getAccountConfig(selectedAccountId);
-        if (!accountProperties.autoAnswer && !accountProperties.isRendezVous) {
+        if (!accountProperties.isRendezVous) {
             // App not focused or in different account
             if (QApplication::focusObject() == nullptr || accountId != selectedAccountId) {
                 showNotification(accountId, convInfo.uid);
@@ -184,8 +184,9 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati
             } else { // Not current conversation
                 if (currentConvHasCall) {
                     auto currentCall = callModel->getCall(currentConvInfo.callId);
-                    if (currentCall.status == lrc::api::call::Status::CONNECTED
-                        || currentCall.status == lrc::api::call::Status::IN_PROGRESS) {
+                    if ((currentCall.status == lrc::api::call::Status::CONNECTED
+                        || currentCall.status == lrc::api::call::Status::IN_PROGRESS)
+                            && !accountProperties.autoAnswer) {
                         showNotification(accountId, convInfo.uid);
                         return;
                     }
-- 
GitLab