diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-23 11:51:53 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-23 11:51:53 (GMT) |
commit | 3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc (patch) | |
tree | 471bb5460ac2f23647282a7e6d37846953ea994d /Swift/Controllers/Highlighter.cpp | |
parent | d773cc196eb63618fe0c426d4eafd7fe8ec69873 (diff) | |
download | swift-3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc.zip swift-3a41fca4c1c2423c1f13cc3c77f9a70f767ae2dc.tar.bz2 |
Preventing stale highlight rules by creating list encapsulation.
Change-Id: I8f95d6bfd769fb104d972bd1cabfeb3ad79d308b
Diffstat (limited to 'Swift/Controllers/Highlighter.cpp')
-rw-r--r-- | Swift/Controllers/Highlighter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Swift/Controllers/Highlighter.cpp b/Swift/Controllers/Highlighter.cpp index 754641a..32d5739 100644 --- a/Swift/Controllers/Highlighter.cpp +++ b/Swift/Controllers/Highlighter.cpp @@ -24,9 +24,11 @@ void Highlighter::setMode(Mode mode) HighlightAction Highlighter::findAction(const std::string& body, const std::string& sender) const { - foreach (const HighlightRule & r, manager_->getRules()) { - if (r.isMatch(body, sender, nick_, messageType_)) { - return r.getAction(); + HighlightRulesListPtr rules = manager_->getRules(); + for (size_t i = 0; i < rules->getSize(); ++i) { + const HighlightRule &rule = rules->getRule(i); + if (rule.isMatch(body, sender, nick_, messageType_)) { + return rule.getAction(); } } |