Skip to content
Snippets Groups Projects
Commit 46c74061 authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

misc: fix set general preference without reload

If a general preference is set and it does not require
reload, then all account preferences should be modified.

GitLab: #24

Change-Id: If587555fad40fb3962b790f336c9bbefaedcb1f7
parent d7638779
No related branches found
No related tags found
No related merge requests found
......@@ -51,15 +51,22 @@ PluginPreferenceHandler::setPreferenceAttribute(const std::string& accountId,
const std::string& key,
const std::string& value)
{
if (accountId.empty()) {
for (auto& prefMap : preferences_) {
auto it = prefMap.second.find(key);
if (it != prefMap.second.end() && it->second != value) {
it->second = value;
}
}
} else {
auto accIt = preferences_.find("default");
if (!accountId.empty())
accIt = preferences_.emplace(accountId, preferences_["default"]).first;
auto it = accIt->second.find(key);
if (it != accIt->second.end() && it->second != value) {
it->second = value;
}
}
}
void
PluginPreferenceHandler::resetPreferenceAttributes(const std::string& accountId)
......
......@@ -52,14 +52,22 @@ PluginPreferenceHandler::setPreferenceAttribute(const std::string& accountId,
const std::string& key,
const std::string& value)
{
if (accountId.empty()) {
for (auto& prefMap : preferences_) {
auto it = prefMap.second.find(key);
if (it != prefMap.second.end() && it->second != value) {
it->second = value;
}
}
} else {
auto accIt = preferences_.find("default");
if (!accountId.empty())
accIt = preferences_.emplace(accountId, preferences_["default"]).first;
auto it = accIt->second.find(key);
if (it != accIt->second.end() && it->second != value) {
it->second = value;
}
}
wmh_->setParameters(accountId);
}
......
......@@ -82,9 +82,9 @@ WatermarkMediaHandler::notifyAVFrameSubject(const StreamData& data, jami::avSubj
void
WatermarkMediaHandler::setParameters(const std::string& accountId)
{
if (accountId != accountId_)
if (!accountId.empty() && accountId != accountId_)
return;
auto preferences = aph_->getPreferences(accountId);
auto preferences = aph_->getPreferences(accountId_);
try {
mediaSubscriber_->setParameter(preferences["fontsize"], Parameter::FONTSIZE);
mediaSubscriber_->setParameter(preferences["logosize"], Parameter::LOGOSIZE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment