1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 12:03:18 +02:00

misc: cleanup, remove cacheAvatars

Now there is only one client, this doesn't need to be configured

Change-Id: Iba1265fbdb8ab18bfb44fc7c2c70ebfe6000ee2c
GitLab: #1305
This commit is contained in:
Sébastien Blin 2023-09-15 13:29:52 -04:00
parent 1a12cb3b8c
commit 7a84518f2c
6 changed files with 6 additions and 35 deletions

View file

@ -231,7 +231,6 @@ MainApplication::initLrc(const QString& downloadUrl,
bool debugMode,
bool muteDaemon)
{
lrc::api::Lrc::cacheAvatars.store(false);
/*
* Init mainwindow and finish splash when mainwindow shows up.
*/

View file

@ -114,11 +114,6 @@ public:
*/
static std::atomic_bool holdConferences;
/**
* If cache contact's avatar or reload
*/
static std::atomic_bool cacheAvatars;
/**
* Make monitor continous or discrete
*/

View file

@ -440,16 +440,6 @@ buildContactFromProfile(const QString& accountId,
const auto vCard = lrc::vCard::utils::toHashMap(file.readAll());
const auto alias = vCard[vCard::Property::FORMATTED_NAME];
if (lrc::api::Lrc::cacheAvatars.load()) {
if (overridenAvatar.isEmpty()) {
for (const auto& key : vCard.keys()) {
if (key.contains("PHOTO"))
profileInfo.avatar = vCard[key];
}
} else {
profileInfo.avatar = overridenAvatar;
}
}
profileInfo.alias = overridenAlias.isEmpty() ? alias : overridenAlias;
return {profileInfo, "", type == api::profile::Type::JAMI, false};
}

View file

@ -1583,8 +1583,7 @@ CallModelPimpl::slotincomingVCardChunk(const QString& accountId,
contactInfo.profileInfo = profileInfo;
linked.owner.contactModel->addContact(contactInfo);
if (!lrc::api::Lrc::cacheAvatars.load())
contactInfo.profileInfo.avatar.clear();
contactInfo.profileInfo.avatar.clear(); // Do not want avatar in memory here
vcardsChunks.erase(from); // Transfer is finish, we don't want to reuse this entry.
}
} else {

View file

@ -386,8 +386,8 @@ ContactModel::updateContact(const QString& uri, const MapStringString& infos)
if (ci != pimpl_->contacts.end()) {
if (infos.contains("avatar")) {
ci->profileInfo.avatar = storage::vcard::compressedAvatar(infos["avatar"]);
} else if (!lrc::api::Lrc::cacheAvatars.load()) {
// Else it will be reseted
} else {
// Else it will be resetted
ci->profileInfo.avatar = storage::avatar(owner.id, uri);
}
if (infos.contains("title"))
@ -743,16 +743,9 @@ ContactModelPimpl::fillWithJamiContacts()
const auto vCard = lrc::vCard::utils::toHashMap(payload);
const auto alias = vCard["FN"];
QByteArray photo;
for (const auto& key : vCard.keys()) {
if (key.contains("PHOTO") && lrc::api::Lrc::cacheAvatars.load())
photo = vCard[key];
}
contactInfo.profileInfo.type = profile::Type::PENDING;
if (!alias.isEmpty())
contactInfo.profileInfo.alias = alias.constData();
if (!photo.isEmpty())
contactInfo.profileInfo.avatar = photo.constData();
contactInfo.registeredName = "";
contactInfo.isBanned = false;
@ -937,9 +930,7 @@ ContactModelPimpl::addToContacts(const QString& contactUri,
updateProfile = true;
contactInfo.profileInfo.alias = profileInfo.alias;
}
auto oldAvatar = lrc::api::Lrc::cacheAvatars.load()
? contactInfo.profileInfo.avatar
: storage::avatar(linked.owner.id, contactUri);
auto oldAvatar = storage::avatar(linked.owner.id, contactUri);
if (!profileInfo.avatar.isEmpty() && oldAvatar != profileInfo.avatar) {
updateProfile = true;
contactInfo.profileInfo.avatar = profileInfo.avatar;
@ -949,8 +940,7 @@ ContactModelPimpl::addToContacts(const QString& contactUri,
contactInfo.isBanned = banned;
contactInfo.conversationId = conversationId;
if (!lrc::api::Lrc::cacheAvatars.load())
contactInfo.profileInfo.avatar.clear();
contactInfo.profileInfo.avatar.clear();
if (type == profile::Type::JAMI) {
ConfigurationManager::instance().lookupAddress(linked.owner.id, "", contactUri);
@ -1229,8 +1219,7 @@ ContactModelPimpl::slotProfileReceived(const QString& accountId,
contactInfo.profileInfo = profileInfo;
linked.owner.contactModel->addContact(contactInfo);
if (!lrc::api::Lrc::cacheAvatars.load())
contactInfo.profileInfo.avatar.clear(); // Do not store after update
contactInfo.profileInfo.avatar.clear(); // Do not store after update
}
void

View file

@ -45,7 +45,6 @@ namespace lrc {
using namespace api;
std::atomic_bool lrc::api::Lrc::holdConferences;
std::atomic_bool lrc::api::Lrc::cacheAvatars {true};
// To judge whether the call is finished or not depending on callState
bool isFinished(const QString& callState);