From eb40763bd1d22bb6ad5b04928967ebfcbb297d54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Mon, 6 May 2019 11:13:15 -0400
Subject: [PATCH] contactmodel: remove pending requests for SIP

Change-Id: I04bb0e235d1d70da968993d44c845785fd02be46
---
 src/contactmodel.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index 15971d70..c6f87064 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -827,8 +827,11 @@ ContactModelPimpl::slotNewAccountMessage(std::string& accountId,
         if (contacts.find(from) == contacts.end()) {
             // Contact not found, load profile from database.
             // The conversation model will create an entry and link the incomingCall.
-            addToContacts(from, profile::Type::PENDING, false);
-            emitNewTrust = true;
+            auto type = (linked.owner.profileInfo.type == profile::Type::RING)
+                            ? profile::Type::PENDING
+                            : profile::Type::SIP;
+            addToContacts(from, type, false);
+            emitNewTrust = (linked.owner.profileInfo.type == profile::Type::RING);
         }
     }
     if (emitNewTrust) {
@@ -848,8 +851,11 @@ ContactModelPimpl::slotNewAccountTransfer(long long dringId, datatransfer::Info
         if (contacts.find(info.peerUri) == contacts.end()) {
             // Contact not found, load profile from database.
             // The conversation model will create an entry and link the incomingCall.
-            addToContacts(info.peerUri, profile::Type::PENDING, false);
-            emitNewTrust = true;
+            auto type = (linked.owner.profileInfo.type == profile::Type::RING)
+                            ? profile::Type::PENDING
+                            : profile::Type::SIP;
+            addToContacts(info.peerUri, type, false);
+            emitNewTrust = (linked.owner.profileInfo.type == profile::Type::RING);
         }
     }
     if (emitNewTrust) {
-- 
GitLab