summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-01-23 11:51:53 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-01-23 11:51:53 (GMT)
commit3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc (patch)
tree471bb5460ac2f23647282a7e6d37846953ea994d /Swift/Controllers/Chat/ChatMessageParser.cpp
parentd773cc196eb63618fe0c426d4eafd7fe8ec69873 (diff)
downloadswift-3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc.zip
swift-3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc.tar.bz2
Preventing stale highlight rules by creating list encapsulation.
Change-Id: I8f95d6bfd769fb104d972bd1cabfeb3ad79d308b
Diffstat (limited to 'Swift/Controllers/Chat/ChatMessageParser.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatMessageParser.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatMessageParser.cpp b/Swift/Controllers/Chat/ChatMessageParser.cpp
index de4abb1..a43ef0e 100644
--- a/Swift/Controllers/Chat/ChatMessageParser.cpp
+++ b/Swift/Controllers/Chat/ChatMessageParser.cpp
@@ -20,9 +20,9 @@
namespace Swift {
- ChatMessageParser::ChatMessageParser(const std::map<std::string, std::string>& emoticons, const std::vector<HighlightRule>& highlightRules)
- : emoticons_(emoticons), highlightRules_(highlightRules) {
-
+ ChatMessageParser::ChatMessageParser(const std::map<std::string, std::string>& emoticons, HighlightRulesListPtr highlightRules)
+ : emoticons_(emoticons), highlightRules_(highlightRules)
+ {
}
typedef std::pair<std::string, std::string> StringPair;
@@ -126,7 +126,8 @@ namespace Swift {
{
ChatWindow::ChatMessage parsedMessage = message;
- foreach(const HighlightRule &rule, highlightRules_) {
+ for (size_t i = 0; i < highlightRules_->getSize(); ++i) {
+ const HighlightRule& rule = highlightRules_->getRule(i);
foreach(const boost::regex &regex, rule.getKeywordRegex()) {
ChatWindow::ChatMessage newMessage;
foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, parsedMessage.getParts()) {