From e2ff654edf9c495480833e2033cff855bf3539c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 25 Jul 2019 10:58:05 -0400 Subject: [PATCH] conversationmodel: connect callback earlier for SIP account Because the action is immediate for SIP accounts, the callback should be created earlier to avoid to miss the signal. Change-Id: Ia189c8c499093f3993020a9ed69d4e7d386a167e --- src/conversationmodel.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp index 7ced9c9b..7dfb5889 100644 --- a/src/conversationmodel.cpp +++ b/src/conversationmodel.cpp @@ -559,8 +559,6 @@ ConversationModelPimpl::placeCall(const std::string& uid, bool isAudioOnly) return; } - sendContactRequest(participant); - if (linked.owner.profileInfo.type != profile::Type::SIP) { url = "ring:" + url; // Add the ring: before or it will fail. } @@ -596,7 +594,11 @@ ConversationModelPimpl::placeCall(const std::string& uid, bool isAudioOnly) delete connection; } }); - } else { + } + + sendContactRequest(participant); + + if (!isTemporary) { cb(convId); } } @@ -637,19 +639,6 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body) it might me destroyed while we are reading it */ const auto participants = conversation.participants; - /* Check participants list, send contact request if needed. - NOTE: conferences are not implemented yet, so we have only one participant */ - for (const auto& participant: participants) { - auto contactInfo = owner.contactModel->getContact(participant); - - if (contactInfo.isBanned) { - qDebug() << "ContactModel::sendMessage: denied, contact is banned"; - return; - } - - pimpl_->sendContactRequest(participant); - } - auto cb = std::function<void(std::string)>( [this, accountId, isTemporary, body, &conversation](std::string convId) { /* Now we should be able to retrieve the final conversation, in case the previous @@ -731,7 +720,22 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body) delete connection; } }); - } else { + } + + /* Check participants list, send contact request if needed. + NOTE: conferences are not implemented yet, so we have only one participant */ + for (const auto& participant: participants) { + auto contactInfo = owner.contactModel->getContact(participant); + + if (contactInfo.isBanned) { + qDebug() << "ContactModel::sendMessage: denied, contact is banned"; + return; + } + + pimpl_->sendContactRequest(participant); + } + + if (!isTemporary) { cb(convId); } } -- GitLab