diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-22 09:11:05 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-22 09:11:05 (GMT) |
commit | 90d05f4fc34d5ee81593ffacd6333a3ee3787072 (patch) | |
tree | a47a6cab8c8d1f7bfa6f4b11247de3e1ca2007ab /Swift | |
parent | 63ced97ecbd91cb73f91cd8571bdf49ef9f36988 (diff) | |
download | swift-90d05f4fc34d5ee81593ffacd6333a3ee3787072.zip swift-90d05f4fc34d5ee81593ffacd6333a3ee3787072.tar.bz2 |
Preparing to add ChatMessage highlight rules.
Change-Id: I71419e255b821dfaec9a8f23316f927193e975c5
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/ChatMessageParser.cpp | 3 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatMessageParser.h | 3 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp | 2 |
5 files changed, 7 insertions, 5 deletions
diff --git a/Swift/Controllers/Chat/ChatMessageParser.cpp b/Swift/Controllers/Chat/ChatMessageParser.cpp index ce184ea..8449901 100644 --- a/Swift/Controllers/Chat/ChatMessageParser.cpp +++ b/Swift/Controllers/Chat/ChatMessageParser.cpp @@ -20,7 +20,8 @@ namespace Swift { - ChatMessageParser::ChatMessageParser(const std::map<std::string, std::string>& emoticons) : emoticons_(emoticons) { + ChatMessageParser::ChatMessageParser(const std::map<std::string, std::string>& emoticons, const std::vector<HighlightRule>& highlightRules) + : emoticons_(emoticons), highlightRules_(highlightRules) { } diff --git a/Swift/Controllers/Chat/ChatMessageParser.h b/Swift/Controllers/Chat/ChatMessageParser.h index c9b9456..dd0d1bd 100644 --- a/Swift/Controllers/Chat/ChatMessageParser.h +++ b/Swift/Controllers/Chat/ChatMessageParser.h @@ -14,10 +14,11 @@ namespace Swift { class ChatMessageParser { public: - ChatMessageParser(const std::map<std::string, std::string>& emoticons); + ChatMessageParser(const std::map<std::string, std::string>& emoticons, const std::vector<HighlightRule>& highlightRules); ChatWindow::ChatMessage parseMessageBody(const std::string& body); private: std::map<std::string, std::string> emoticons_; + std::vector<HighlightRule> highlightRules_; }; } diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index a7e8b73..6c5d6d9 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -155,7 +155,7 @@ ChatsManager::ChatsManager( uiEventStream_ = uiEventStream; mucBookmarkManager_ = NULL; profileSettings_ = profileSettings; - chatMessageParser_ = new ChatMessageParser(emoticons); + chatMessageParser_ = new ChatMessageParser(emoticons, highlightManager->getRules()); presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); diff --git a/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp index 44d7834..414fc8e 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp @@ -48,7 +48,7 @@ public: } void testFullBody() { - ChatMessageParser testling(emoticons_); + ChatMessageParser testling(emoticons_, std::vector<HighlightRule>()); ChatWindow::ChatMessage result = testling.parseMessageBody(":) shiny :( :) http://wonderland.lit/blah http://denmark.lit boom boom"); assertEmoticon(result, 0, smile1_, smile1Path_); assertText(result, 1, " shiny "); diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index 3652e86..90a4740 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -81,7 +81,7 @@ public: highlightManager_ = new HighlightManager(settings_); muc_ = boost::make_shared<MockMUC>(mucJID_); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(muc_->getJID(), uiEventStream_).Return(window_); - chatMessageParser_ = new ChatMessageParser(std::map<std::string, std::string>()); + chatMessageParser_ = new ChatMessageParser(std::map<std::string, std::string>(), highlightManager_->getRules()); vcardStorage_ = new VCardMemoryStorage(crypto_.get()); vcardManager_ = new VCardManager(self_, iqRouter_, vcardStorage_); controller_ = new MUCController (self_, muc_, boost::optional<std::string>(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, NULL, NULL, mucRegistry_, highlightManager_, chatMessageParser_, false, NULL, vcardManager_); |