mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
AccountManager: avoid saving contacts if no change
Change-Id: I89a5aea23d1c64566404b4bc0cfa9d8bddfaf46e
This commit is contained in:
@ -67,10 +67,11 @@ AccountManager::onSyncData(DeviceSync&& sync, bool checkDevice)
|
||||
}
|
||||
|
||||
// Sync known devices
|
||||
JAMI_DEBUG("[Account {}] [Contacts] received device sync data ({:d} devices, {:d} contacts)",
|
||||
JAMI_DEBUG("[Account {}] [Contacts] received device sync data ({:d} devices, {:d} contacts, {:d} requests)",
|
||||
accountId_,
|
||||
sync.devices_known.size() + sync.devices.size(),
|
||||
sync.peers.size());
|
||||
sync.peers.size(),
|
||||
sync.trust_requests.size());
|
||||
for (const auto& d : sync.devices_known) {
|
||||
findCertificate(d.first, [this, d](const std::shared_ptr<dht::crypto::Certificate>& crt) {
|
||||
if (not crt)
|
||||
@ -91,10 +92,12 @@ AccountManager::onSyncData(DeviceSync&& sync, bool checkDevice)
|
||||
// saveKnownDevices();
|
||||
|
||||
// Sync contacts
|
||||
for (const auto& peer : sync.peers) {
|
||||
info_->contacts->updateContact(peer.first, peer.second);
|
||||
if (!sync.peers.empty()) {
|
||||
for (const auto &peer: sync.peers) {
|
||||
info_->contacts->updateContact(peer.first, peer.second);
|
||||
}
|
||||
info_->contacts->saveContacts();
|
||||
}
|
||||
info_->contacts->saveContacts();
|
||||
|
||||
// Sync trust requests
|
||||
for (const auto& tr : sync.trust_requests)
|
||||
|
Reference in New Issue
Block a user