Option to control Ldap Friend cache clearing

This commit is contained in:
Christophe Deschamps 2025-01-10 12:17:18 +01:00
parent 98cadf8b5d
commit 6833dd10d2
3 changed files with 17 additions and 4 deletions

View file

@ -96,10 +96,12 @@ void CoreModel::start() {
mCore->setUserAgent(Utils::appStringToCoreString(userAgent), LINPHONESDK_VERSION);
mCore->start();
setPathAfterStart();
// Remove ldap friends cache list. If not, old stored friends will take priority on merge and will not be updated
// from new LDAP requests..
auto ldapFriendList = mCore->getFriendListByName("ldap_friends");
if (ldapFriendList) mCore->removeFriendList(ldapFriendList);
if (SettingsModel::clearLocalLdapFriendsUponStartup(config)) {
// Remove ldap friends cache list. If not, old stored friends will take priority on merge and will not be
// updated from new LDAP requests..
auto ldapFriendList = mCore->getFriendListByName("ldap_friends");
if (ldapFriendList) mCore->removeFriendList(ldapFriendList);
}
mCore->enableFriendListSubscription(true);
// TODO : get this from settings
auto videoPolicy = mCore->getVideoActivationPolicy()->clone();

View file

@ -603,6 +603,15 @@ QString SettingsModel::getDeviceName(const std::shared_ptr<linphone::Config> &co
config->getString(UiSection, "device_name", Utils::appStringToCoreString(QSysInfo::machineHostName())));
}
// ==============================================================================
// Clears the local "ldap_friends" friend list upon startup (Ldap contacts cache)
// ==============================================================================
bool SettingsModel::clearLocalLdapFriendsUponStartup(const shared_ptr<linphone::Config> &config) {
mustBeInLinphoneThread(sLog().arg(Q_FUNC_INFO));
return config ? config->getBool(UiSection, "clear_local_ldap_friends_upon_startup", false) : false;
}
// =============================================================================
// Ui.
// =============================================================================

View file

@ -143,6 +143,8 @@ public:
static QString getDeviceName(const std::shared_ptr<linphone::Config> &config);
static bool clearLocalLdapFriendsUponStartup(const std::shared_ptr<linphone::Config> &config);
// UI
DECLARE_GETSET(bool, disableChatFeature, DisableChatFeature)
DECLARE_GETSET(bool, disableMeetingsFeature, DisableMeetingsFeature)