From 639db5f27911c4bc994e6a040561d596a0f77113 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Tue, 7 Mar 2017 11:12:25 +0100
Subject: 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

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
@@ -50,8 +50,6 @@ 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;
diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp
index 048fe99..4dd67f1 100644
--- a/Swift/QtUI/QtWebKitChatView.cpp
+++ b/Swift/QtUI/QtWebKitChatView.cpp
@@ -483,15 +483,15 @@ std::string QtWebKitChatView::addMessage(
 }
 
 QString QtWebKitChatView::getHighlightSpanStart(const std::string& text, const std::string& background) {
-    QString ecsapeColor = QtUtilities::htmlEscape(P2QSTRING(text));
-    QString escapeBackground = QtUtilities::htmlEscape(P2QSTRING(background));
-    if (ecsapeColor.isEmpty()) {
-        ecsapeColor = "black";
+    QString ecsapeColor;
+    QString escapeBackground;
+    if (!text.empty()) {
+        ecsapeColor = QString("color: %1").arg(QtUtilities::htmlEscape(P2QSTRING(text)));
     }
-    if (escapeBackground.isEmpty()) {
-        escapeBackground = "yellow";
+    if (!background.empty()) {
+        escapeBackground = QString("background: %1").arg(QtUtilities::htmlEscape(P2QSTRING(background)));
     }
-    return QString("<span style=\"color: %1; background: %2\">").arg(ecsapeColor).arg(escapeBackground);
+    return QString("<span style=\"%1; %2;\">").arg(ecsapeColor).arg(escapeBackground);
 }
 
 QString QtWebKitChatView::getHighlightSpanStart(const HighlightAction& highlight) {
-- 
cgit v0.10.2-6-g49f6