From dddfb405de9d04f50d3a95cc3b0ebc3e49884a65 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 22 Aug 2011 03:07:13 +0300 Subject: Add highlight list option. Before in highlight was only player nick. --- src/gui/chatwindow.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/gui/chatwindow.cpp') 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 -- cgit v1.2.3-60-g2f50