From 499b1955a3d9bb8f64f335f1c363091b7fd9b68d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Mon, 5 Jul 2021 09:32:16 -0400
Subject: [PATCH] behaviorcontroller: pass convId to request

As we slowly move towards conversation's requests. Only the
conversation's id will be necessary.
Also simplify code for notifications client-side.

Change-Id: Iaff595205458db090839af3755570a3ff5bf2013
GitLab: https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/455
---
 src/api/behaviorcontroller.h | 2 +-
 src/contactmodel.cpp         | 8 ++++----
 src/newcallmodel.cpp         | 2 --
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/api/behaviorcontroller.h b/src/api/behaviorcontroller.h
index d5132735..37a42497 100644
--- a/src/api/behaviorcontroller.h
+++ b/src/api/behaviorcontroller.h
@@ -72,7 +72,7 @@ Q_SIGNALS:
     /**
      * Emitted when the client receives a new trust request
      */
-    void newTrustRequest(const QString& accountId, const QString& contactUri) const;
+    void newTrustRequest(const QString& accountId, const QString& conversationId, const QString& contactUri) const;
     /**
      * Emitted when a trust request has been accepted, refused or blocked
      */
diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index d0a78f8a..ee2cacff 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -995,7 +995,7 @@ ContactModelPimpl::slotIncomingContactRequest(const QString& accountId,
     }
     emit linked.incomingContactRequest(contactUri);
     if (emitTrust) {
-        emit behaviorController.newTrustRequest(linked.owner.id, contactUri);
+        emit behaviorController.newTrustRequest(linked.owner.id, conversationId, contactUri);
     }
 }
 
@@ -1028,7 +1028,7 @@ ContactModelPimpl::slotIncomingCall(const QString& fromId,
         if (linked.owner.profileInfo.type == profile::Type::SIP)
             emit linked.contactAdded(fromId);
         else if (linked.owner.profileInfo.type == profile::Type::JAMI)
-            emit behaviorController.newTrustRequest(linked.owner.id, fromId);
+            emit behaviorController.newTrustRequest(linked.owner.id, "", fromId);
     } else
         emit linked.profileUpdated(fromId);
 
@@ -1068,7 +1068,7 @@ ContactModelPimpl::slotNewAccountMessage(const QString& accountId,
         }
     }
     if (emitNewTrust) {
-        emit behaviorController.newTrustRequest(linked.owner.id, peerId);
+        emit behaviorController.newTrustRequest(linked.owner.id, "", peerId);
     }
     emit linked.newAccountMessage(accountId, peerId2, msgId, payloads);
 }
@@ -1149,7 +1149,7 @@ ContactModelPimpl::slotNewAccountTransfer(const QString& fileId, datatransfer::I
         }
     }
     if (emitNewTrust) {
-        emit behaviorController.newTrustRequest(linked.owner.id, info.peerUri);
+        emit behaviorController.newTrustRequest(linked.owner.id, "", info.peerUri);
     }
 
     emit linked.newAccountTransfer(fileId, info);
diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp
index f8748d01..428d19dd 100644
--- a/src/newcallmodel.cpp
+++ b/src/newcallmodel.cpp
@@ -505,8 +505,6 @@ NewCallModel::toggleMedia(const QString& callId, const NewCallModel::Media media
 {
     if (!hasCall(callId))
         return;
-    auto& call = pimpl_->calls[callId];
-
     auto mediaLabel = media == NewCallModel::Media::VIDEO ? "video_0" : "audio_0";
     requestMediaChange(callId, mediaLabel);
 }
-- 
GitLab