From a89c763495e01c772049e994de7a19e6e9df53e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 3 Aug 2021 14:09:52 -0400 Subject: [PATCH] jamiaccount: do not try to sync removed conversation Also clarify a log. GitLab: https://git.jami.net/savoirfairelinux/ring-project/-/issues/1282 Change-Id: Id7a4bd88886159e7a6d053b5858222a864e3cca5 --- src/jamidht/account_manager.cpp | 14 ++++++++------ src/jamidht/jamiaccount.cpp | 5 ++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/jamidht/account_manager.cpp b/src/jamidht/account_manager.cpp index ec8a9494c0..333d86e958 100644 --- a/src/jamidht/account_manager.cpp +++ b/src/jamidht/account_manager.cpp @@ -252,10 +252,12 @@ AccountManager::startSync(const OnNewDeviceCb& cb, const OnDeviceAnnouncedCb& dc true, [this, v](const std::shared_ptr<dht::crypto::Certificate>&, dht::InfoHash peer_account) mutable { - JAMI_WARN("Got trust request from: %s / %s. ConversationId: %s", - peer_account.toString().c_str(), - v.from.toString().c_str(), - v.conversationId.c_str()); + JAMI_WARN( + "Got trust request (confirm: %u) from: %s / %s. ConversationId: %s", + v.confirm, + peer_account.toString().c_str(), + v.from.toString().c_str(), + v.conversationId.c_str()); if (info_) if (info_->contacts->onTrustRequest(peer_account, v.owner, @@ -732,8 +734,8 @@ AccountManager::forEachDevice( struct State { - unsigned remaining { - 1}; // Note: state is initialized to 1, because we need to wait that the get is finished + // Note: state is initialized to 1, because we need to wait that the get is finished + unsigned remaining {1}; std::set<dht::PkId> treatedDevices {}; std::function<void(const std::shared_ptr<dht::crypto::PublicKey>&)> onDevice; std::function<void(bool)> onEnd; diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 5910a1c50d..7e93f0711c 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2009,10 +2009,9 @@ JamiAccount::syncConversations(const std::string& peer, const DeviceId& deviceId for (const auto& [key, ci] : infos->conversations) { auto it = conversations_.find(key); if (it != conversations_.end() && it->second) { - if (it->second->isMember(peer, false)) + if (!it->second->isRemoving() && it->second->isMember(peer, false)) toFetch.emplace(key); - } else if (std::find(ci.members.begin(), ci.members.end(), peer) - != ci.members.end()) { + } else if (!ci.removed && std::find(ci.members.begin(), ci.members.end(), peer) != ci.members.end()) { // In this case the conversation was never cloned (can be after an import) toClone.emplace(key); } -- GitLab