mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45:45 +02:00
contactmodel: no need to call both addContact/acceptConversationRequest
only acceptConversationRequest is enough to accept a request Change-Id: I4720ea70def6cd35153167ef9577b1c7528e7140
This commit is contained in:
parent
97297eacf7
commit
24a0a384ff
2 changed files with 4 additions and 9 deletions
|
@ -239,7 +239,6 @@ void
|
||||||
ContactModel::addContact(contact::Info contactInfo)
|
ContactModel::addContact(contact::Info contactInfo)
|
||||||
{
|
{
|
||||||
auto& profile = contactInfo.profileInfo;
|
auto& profile = contactInfo.profileInfo;
|
||||||
|
|
||||||
// If passed contact is a banned contact, call the daemon to unban it
|
// If passed contact is a banned contact, call the daemon to unban it
|
||||||
auto it = std::find(pimpl_->bannedContacts.begin(), pimpl_->bannedContacts.end(), profile.uri);
|
auto it = std::find(pimpl_->bannedContacts.begin(), pimpl_->bannedContacts.end(), profile.uri);
|
||||||
if (it != pimpl_->bannedContacts.end()) {
|
if (it != pimpl_->bannedContacts.end()) {
|
||||||
|
|
|
@ -1755,14 +1755,12 @@ void
|
||||||
ConversationModel::acceptConversationRequest(const QString& conversationId)
|
ConversationModel::acceptConversationRequest(const QString& conversationId)
|
||||||
{
|
{
|
||||||
auto conversationOpt = getConversationForUid(conversationId);
|
auto conversationOpt = getConversationForUid(conversationId);
|
||||||
if (!conversationOpt.has_value()) {
|
if (!conversationOpt.has_value())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
auto& conversation = conversationOpt->get();
|
auto& conversation = conversationOpt->get();
|
||||||
auto& peers = pimpl_->peersForConversation(conversation);
|
auto& peers = pimpl_->peersForConversation(conversation);
|
||||||
if (peers.isEmpty()) {
|
if (peers.isEmpty())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (conversation.isSwarm()) {
|
if (conversation.isSwarm()) {
|
||||||
conversation.needsSyncing = true;
|
conversation.needsSyncing = true;
|
||||||
|
@ -1772,8 +1770,6 @@ ConversationModel::acceptConversationRequest(const QString& conversationId)
|
||||||
ConfigurationManager::instance().acceptConversationRequest(owner.id, conversationId);
|
ConfigurationManager::instance().acceptConversationRequest(owner.id, conversationId);
|
||||||
} else {
|
} else {
|
||||||
pimpl_->sendContactRequest(peers.front());
|
pimpl_->sendContactRequest(peers.front());
|
||||||
}
|
|
||||||
if (conversation.isCoreDialog()) {
|
|
||||||
try {
|
try {
|
||||||
auto contact = owner.contactModel->getContact(peers.front());
|
auto contact = owner.contactModel->getContact(peers.front());
|
||||||
auto notAdded = contact.profileInfo.type == profile::Type::TEMPORARY
|
auto notAdded = contact.profileInfo.type == profile::Type::TEMPORARY
|
||||||
|
@ -1783,6 +1779,7 @@ ConversationModel::acceptConversationRequest(const QString& conversationId)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
} catch (std::out_of_range& e) {
|
||||||
|
qWarning() << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2731,9 +2728,8 @@ ConversationModelPimpl::slotConversationRequestReceived(const QString& accountId
|
||||||
const QString&,
|
const QString&,
|
||||||
const MapStringString& metadatas)
|
const MapStringString& metadatas)
|
||||||
{
|
{
|
||||||
if (accountId != linked.owner.id) {
|
if (accountId != linked.owner.id)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
addConversationRequest(metadatas, true);
|
addConversationRequest(metadatas, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue