summaryrefslogtreecommitdiff
path: root/src/gui/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-22 03:07:13 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-22 03:07:13 +0300
commitdddfb405de9d04f50d3a95cc3b0ebc3e49884a65 (patch)
tree4bb96a90cb585a65025533e512e7c3de7cffed00 /src/gui/chatwindow.cpp
parent07c2eb8ffd62fe69f410cc045efc837441a6b6d4 (diff)
downloadmanaverse-dddfb405de9d04f50d3a95cc3b0ebc3e49884a65.tar.gz
manaverse-dddfb405de9d04f50d3a95cc3b0ebc3e49884a65.tar.bz2
manaverse-dddfb405de9d04f50d3a95cc3b0ebc3e49884a65.tar.xz
manaverse-dddfb405de9d04f50d3a95cc3b0ebc3e49884a65.zip
Add highlight list option.
Before in highlight was only player nick.
Diffstat (limited to 'src/gui/chatwindow.cpp')
-rw-r--r--src/gui/chatwindow.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 1ef3139db..8896ca028 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -211,6 +211,7 @@ ChatWindow::ChatWindow():
fillCommands();
initTradeFilter();
loadCustomList();
+ parseHighlights();
}
ChatWindow::~ChatWindow()
@@ -1503,7 +1504,7 @@ void ChatWindow::addToAwayLog(std::string line)
if (mAwayLog.size() > 20)
mAwayLog.pop_front();
- if (line.find(player_node->getName()) != std::string::npos)
+ if (findI(line, mHighlights) != std::string::npos)
mAwayLog.push_back("##9away:" + line);
}
@@ -1520,3 +1521,20 @@ void ChatWindow::displayAwayLog()
++i;
}
}
+
+void ChatWindow::parseHighlights()
+{
+ mHighlights.clear();
+ if (!player_node)
+ return;
+
+ splitToStringVector(mHighlights, config.getStringValue(
+ "highlightWords"), ',');
+
+ mHighlights.push_back(player_node->getName());
+}
+
+bool ChatWindow::findHighlight(std::string &str)
+{
+ return findI(str, mHighlights) != std::string::npos;
+} \ No newline at end of file