Skip to content
Snippets Groups Projects
Commit e2ff654e authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk
Browse files

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
parent 3471a99e
Branches
No related tags found
No related merge requests found
...@@ -559,8 +559,6 @@ ConversationModelPimpl::placeCall(const std::string& uid, bool isAudioOnly) ...@@ -559,8 +559,6 @@ ConversationModelPimpl::placeCall(const std::string& uid, bool isAudioOnly)
return; return;
} }
sendContactRequest(participant);
if (linked.owner.profileInfo.type != profile::Type::SIP) { if (linked.owner.profileInfo.type != profile::Type::SIP) {
url = "ring:" + url; // Add the ring: before or it will fail. url = "ring:" + url; // Add the ring: before or it will fail.
} }
...@@ -596,7 +594,11 @@ ConversationModelPimpl::placeCall(const std::string& uid, bool isAudioOnly) ...@@ -596,7 +594,11 @@ ConversationModelPimpl::placeCall(const std::string& uid, bool isAudioOnly)
delete connection; delete connection;
} }
}); });
} else { }
sendContactRequest(participant);
if (!isTemporary) {
cb(convId); cb(convId);
} }
} }
...@@ -637,19 +639,6 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body) ...@@ -637,19 +639,6 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body)
it might me destroyed while we are reading it */ it might me destroyed while we are reading it */
const auto participants = conversation.participants; 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)>( auto cb = std::function<void(std::string)>(
[this, accountId, isTemporary, body, &conversation](std::string convId) { [this, accountId, isTemporary, body, &conversation](std::string convId) {
/* Now we should be able to retrieve the final conversation, in case the previous /* 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) ...@@ -731,7 +720,22 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body)
delete connection; 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); cb(convId);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment