diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp index 7ced9c9b922c529a53ed6b55138ca44d9df30fde..7dfb58896144365bec6ab45aca57d469fc4dd5a3 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); } }