From 19c5c27c24a2fb8c215276a40f607754f8b68827 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Mon, 21 Sep 2020 11:47:54 -0400
Subject: [PATCH] newcallmodel: ignore potential ring://

Change-Id: I4500a864c5cc65f357121a90907fd2261bff594e
---
 src/newcallmodel.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp
index 25cd277b..33744647 100644
--- a/src/newcallmodel.cpp
+++ b/src/newcallmodel.cpp
@@ -37,6 +37,7 @@
 #include "vcard.h"
 #include "video/renderer.h"
 #include "typedefs.h"
+#include "uri.h"
 
 // Ring daemon
 #include <media_const.h>
@@ -206,10 +207,13 @@ NewCallModel::~NewCallModel()
 const call::Info&
 NewCallModel::getCallFromURI(const QString& uri, bool notOver) const
 {
-    // peer url = ring:uri or sip number
-    auto url = (owner.profileInfo.type != profile::Type::SIP && !uri.contains("ring:")) ? "ring:" + uri : uri;
+    // For a NON SIP account the scheme can be ring:. Sometimes it can miss, and will be certainly
+    // replaced by jami://.
+    // Just make the comparaison ignoring the scheme and check the rest.
+    auto uriObj = URI(uri);
     for (const auto& call: pimpl_->calls) {
-        if (call.second->peerUri == url) {
+        auto contactUri = URI(call.second->peerUri);
+        if (uriObj.userinfo() == contactUri.userinfo() and uriObj.hostname() == contactUri.hostname()) {
             if (!notOver || !call::isTerminating(call.second->status))
                 return *call.second;
         }
-- 
GitLab