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
......@@ -51,13 +51,20 @@ PluginPreferenceHandler::setPreferenceAttribute(const std::string& accountId,
const std::string& key,
const std::string& value)
{
auto accIt = preferences_.find("default");
if (!accountId.empty())
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");
accIt = preferences_.emplace(accountId, preferences_["default"]).first;
auto it = accIt->second.find(key);
if (it != accIt->second.end() && it->second != value) {
it->second = value;
auto it = accIt->second.find(key);
if (it != accIt->second.end() && it->second != value) {
it->second = value;
}
}
}
......
......@@ -52,14 +52,22 @@ PluginPreferenceHandler::setPreferenceAttribute(const std::string& accountId,
const std::string& key,
const std::string& value)
{
auto accIt = preferences_.find("default");
if (!accountId.empty())
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");
accIt = preferences_.emplace(accountId, preferences_["default"]).first;
auto it = accIt->second.find(key);
if (it != accIt->second.end() && it->second != value) {
it->second = value;
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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment