summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-03-07 10:12:25 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-03-07 12:35:30 (GMT)
commit639db5f27911c4bc994e6a040561d596a0f77113 (patch)
treeaacfdba96ed8f595b6e65ecd43fd6382f71ea82d /Swift/Controllers
parent56c7bc9d6a52dd7095405d2bcf9fca5473a464c3 (diff)
downloadswift-639db5f27911c4bc994e6a040561d596a0f77113.zip
swift-639db5f27911c4bc994e6a040561d596a0f77113.tar.bz2
Do not color highlight mentions of the own nickname by default
In the default highlight configuration, mentions of the own nickname should only cause a notification sound and a system notification. Test-Information: Tested mention notifications in a test MUC room and verified that only sound and system notifications are issued in the default highlight configurations. Tested on macOS 10.12.3 with Qt 5.5.1. Change-Id: I44a276ab740d7495930c935a89a2ef81219e24df
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Highlighting/HighlightManager.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/Swift/Controllers/Highlighting/HighlightManager.cpp b/Swift/Controllers/Highlighting/HighlightManager.cpp
index 89261af..2ca77e7 100644
--- a/Swift/Controllers/Highlighting/HighlightManager.cpp
+++ b/Swift/Controllers/Highlighting/HighlightManager.cpp
@@ -23,62 +23,60 @@
#include <boost/regex.hpp>
#include <boost/serialization/vector.hpp>
#include <Swiften/Base/Log.h>
#include <Swift/Controllers/Highlighting/HighlightConfiguration.h>
#include <Swift/Controllers/Highlighting/Highlighter.h>
#include <Swift/Controllers/SettingConstants.h>
#include <Swift/Controllers/Settings/SettingsProvider.h>
namespace Swift {
HighlightManager::HighlightManager(SettingsProvider* settings)
: settings_(settings)
, storingSettings_(false) {
highlightConfiguration_ = std::make_shared<HighlightConfiguration>();
loadSettings();
handleSettingChangedConnection_ = settings_->onSettingChanged.connect(boost::bind(&HighlightManager::handleSettingChanged, this, _1));
}
void HighlightManager::handleSettingChanged(const std::string& settingPath) {
if (!storingSettings_ && SettingConstants::HIGHLIGHT_RULES.getKey() == settingPath) {
loadSettings();
}
}
HighlightConfiguration HighlightManager::getDefaultConfig() {
HighlightConfiguration defaultConfiguration;
defaultConfiguration.playSoundOnIncomingDirectMessages = true;
defaultConfiguration.showNotificationOnIncomingDirectMessages = true;
- defaultConfiguration.ownMentionAction.setFrontColor(std::string("black"));
- defaultConfiguration.ownMentionAction.setBackColor(std::string("yellow"));
defaultConfiguration.ownMentionAction.setSoundFilePath(std::string("/sounds/message-received.wav"));
defaultConfiguration.ownMentionAction.setSystemNotificationEnabled(true);
return defaultConfiguration;
}
void HighlightManager::storeSettings() {
storingSettings_ = true; // don't reload settings while saving
settings_->storeSetting(SettingConstants::HIGHLIGHT_RULES_V2, highlightConfigurationToString(*highlightConfiguration_));
storingSettings_ = false;
}
void HighlightManager::loadSettings() {
std::string configString = settings_->getSetting(SettingConstants::HIGHLIGHT_RULES_V2);
*highlightConfiguration_ = highlightConfigurationFromString(configString);
}
Highlighter* HighlightManager::createHighlighter(NickResolver* nickResolver) {
return new Highlighter(this, nickResolver);
}
void HighlightManager::resetToDefaultConfiguration() {
*highlightConfiguration_ = getDefaultConfig();
}
HighlightConfiguration HighlightManager::highlightConfigurationFromString(const std::string& dataString) {
std::stringstream stream;
stream << dataString;
HighlightConfiguration configuration;
try {